Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

asp.net how to write out meta information dynamically

  • 31-01-2007 11:37PM
    #1
    Registered Users, Registered Users 2 Posts: 872 ✭✭✭


    Hi,

    Im trying to write out a unique title, keywords and description in an aspx page depending on the id in the querystring.

    I can add a runat server to the title tag (so i can access in the code behind) but cant add on to the meta tags.

    Any ideas how i could write out these values dynamically ?

    thanks


Comments

  • Registered Users, Registered Users 2 Posts: 2,157 ✭✭✭dazberry


    Page.Header.InnerHtml = "<meta... /><title></title>"; etc...

    D.


  • Registered Users, Registered Users 2 Posts: 872 ✭✭✭grahamor


    Thanks for the reply, i found an easier way to do it though::

    [PHP]<title id="title" runat="server">temp title</title>
    <meta name="description" content="description" id="description" runat="server" />
    <meta name="keywords" content="keys" id="keywords" runat="server" />[/PHP]

    Then in the code behind...

    [PHP]public System.Web.UI.HtmlControls.HtmlGenericControl title;
    public System.Web.UI.HtmlControls.HtmlGenericControl keywords;
    public System.Web.UI.HtmlControls.HtmlGenericControl description;

    title.InnerHtml = "my title";
    keywords.Attributes["content"] = "my keywords";
    description.Attributes["content"] = "my description";[/PHP]


Advertisement