Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

asp.net how to write out meta information dynamically

Options
  • 31-01-2007 11:37pm
    #1
    Registered Users 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 Posts: 2,150 ✭✭✭dazberry


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

    D.


  • Registered Users 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