SharePoint: Setting page title from code

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”));

You May Also Like

About the Author: rnowik

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.