Setting an Application Page Title from code
I’m currently dealing with a requirement where I need to the set an application page’s title from the code behind.
By default the form has a ContentPlaceHolder control with a
which in the master page is the text that will fall in the header's title tag. Unfortunately, <asp:Content> controls are not added to the hierarchy at runtime so I can’t access it directly.
protected void Page_Load(object sender, EventArgs e)
HtmlTitle tagTitle = new HtmlTitle();
//Obviously this would be more complex code in practice
tagTitle.Text = "My new title here";
//The parent of "PlaceHolderPageTitle" is the HtmlTitle control