Search code examples
c#titlemaster-pages

Get Page Title In Master Page Code Behind


I want to get the page title in c# master page code behind.

I tried using Page.Header.Title; property but it return null.

Please help me to get the title.

Thanks in advance.

Shibin V.M


Solution

  • In your page head include runat="server" then you can easily get the Page title by

    string Title = Page.Title;
    

    EDIT:

    Using the Title property of Page requires a header control on the page. (e.g. <head runat="server" />).