page title

D

David

Is there a way that I can set the title of a page from the
server. I do not want to use
Page.RegisterClientScriptBlock as this relies on the
clients browser or use a WebUserControl as this increases
overhead. Any suggustions would be appreciated
 
H

H Branyan

David said:
Is there a way that I can set the title of a page from the
server. I do not want to use
Page.RegisterClientScriptBlock as this relies on the
clients browser or use a WebUserControl as this increases
overhead. Any suggustions would be appreciated


Add a tag to your aspx file:
<title id="pageTitle" runat="server" />

Code behind:
Declare the control -
public System.Web.UI.HtmlControl.GenericHtmlControl pageTitle


In page_load or wherever -
pageTitle.InnerHtml = "page title";


something like that, anyway, off the top of my head. Hope this helps.
 
K

Kevin Spencer

You can add a runat=server attribute to the <title> tag, and an ID. Then
wire it up to an HtmlGenericControl in the CodeBehind, and use that control
to manipulate the InnerText property of the tag.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top