Changing page title

R

Rocky Moore

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.
 
S

Shiv Kumar

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top