Changing Title Programmatically
-
Does anyone know how to set the title of an ASP.NET page from a code behind file at runtime (obviously)? I noticed there is a 'runat' and 'id' attribute, but I cannot successfully change the title. Any help would be appreciated. Thanks in advance, Josh There's a fine line between confidence and arrogance.
-
Does anyone know how to set the title of an ASP.NET page from a code behind file at runtime (obviously)? I noticed there is a 'runat' and 'id' attribute, but I cannot successfully change the title. Any help would be appreciated. Thanks in advance, Josh There's a fine line between confidence and arrogance.
In your HTML, for the title tag, do the following: In the code window declare the title tag: protected System.Web.UI.HtmlControls.HtmlGenericControl myTitle; And when you want to set the text, use this: myTitle.InnerText = "Welcome to my site!"; -Thea-
-
In your HTML, for the title tag, do the following: In the code window declare the title tag: protected System.Web.UI.HtmlControls.HtmlGenericControl myTitle; And when you want to set the text, use this: myTitle.InnerText = "Welcome to my site!"; -Thea-
Oops! Let's try again... In your HTML, do this:
-
Oops! Let's try again... In your HTML, do this:
Thank you. I knew it was something simple, but I hadn't tried the GenericControl. Thanks again, Josh There's a fine line between confidence and arrogance.
-
Oops! Let's try again... In your HTML, do this:
Theres also this way <title><%=Title%></title> protected string Title { get{ return = "My Title" } }