SharePoint: Setting page title from code
Thursday, March 19, 2009
To dynamically set the page title from code, you cannot just directly access this.Page.Header.Title as you would with normal asp.net. This is because in the sharepoint default.master, there is a ContentPlaceHolder control with the id "PlaceHolderPageTitle" that overrides. To overcome this, simply use the following code...
ContentPlaceHolder title = this.Page.Master.FindControl("PlaceHolderPageTitle") as ContentPlaceHolder;
title.Controls.Clear();
title.Controls.Add(new LiteralControl("Your title to go here"));
post a comment / view comments (currently 0 comments)
- Bookmark with:
- Delicious
- Digg
- StumbleUpon