Changing page title

  • Thread starter Thread starter SOS
  • Start date Start date
SOS said:
Hi guys ,
how can i change the page title in the run time ?

Thanx

You can add an ID and a RunAt="Server" to your title tag and in the code
behind refer to it by:

protected System.Web.UI.HtmlControls.HtmlGenericControl myTitleTag;

and in your code:

myTitleTag.InnerHTML = "Oh, Boy Page";

Another option to access the data directly on the aspx page in <% %> in
the<Title> tag.
 
You could declare a property in your page class and then have it
automatically replaced when the databind method of the page is called.

So the Page's property could be declared like so:

private string theTitle;

protected string TheTitle { get { return theTitle; } } //

At some point while processing your page you set the property (using the
private variable) and in your .aspx page you could have

<title><%# TheTitle %></title>
 
Back
Top