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 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.Add(new LiteralControl(“Your title to go here”));

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>