Setting Page title doesn't work Setting Page title doesn't work asp.net asp.net

Setting Page title doesn't work


If you want to set the Title from C# code, make sure you don't set a title in the aspx page. (even a blank title will override the Title from the C# code)

This following code will override the Title set in C# code by an empty string:

<%@ Page Language="C#" Title="" ... %>

You have to remove the Title property to be able to set it in C# code:

<%@ Page Language="C#" ... %>


I had a similar issue with with the Title property. Mine problem came back to the <%@ Page %> directive missing the Title property. Make sure you've added the Title property to the Page directive on the ASPX file like:

<%@ Page Language="C#" Title="Default Title" %>


I was switching over to a new Master Page for my pages and my TITLES stopped working.

My old, working Master Page had this

<head runat="server">

My new, failing Master Page had this

<head>

So it was as simple as making sure the tag had runat="server" in it.