page title

  • Thread starter Thread starter David
  • Start date Start date
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
 
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.
 
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.
 
Back
Top