+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Page Title on theme

Page Title on theme

4 posts, 0 answered
  1. Jonathan
    Jonathan avatar
    13 posts
    Registered:
    16 Jun 2012
    18 Sep 2008
    Link to this post
    Is there an easy way to have the page title shown on a Master Page? I just want to put it in something like <%= PageTitle%>

    How would I do this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Sep 2008
    Link to this post
    Hello Jonathan Marbutt,

    Thank you for using our services.

    Here is an example which shows master's page title and <head> tag name title.

    <script runat="server"
    void Page_Load(object sender, EventArgs e) 
        SiteMapNode node = SiteMap.CurrentNode; 
        if (node != null
            pageName.Text = node.Title;// show master page title 
        if (this.Page != null
            pageTitle.Text = this.Page.Title; //show <head> name title 
    </script> 

    You can put the code above in your .cs instead of .master  as we did.


    Hope this helps.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Ricky
    Ricky avatar
    2 posts
    Registered:
    18 Feb 2008
    06 Oct 2008
    Link to this post
    Where does pageName and pageTitle come from? I get a compiler error when pasting your code in my .master file.

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Oct 2008
    Link to this post
    Hello Ricky,

    Thank you for getting back to us.

    Please follow the steps below.
    1. Create a master page.
    2. Add my code from the previous post.
    3. Create two Literal controls in the body of the page as follows.

    <asp:Literal runat="server" ID="pageName"></asp:Literal><br /> 
    <asp:Literal runat="server" ID="pageTitle"></asp:Literal> 


    P.S:
    I am attaching the whole example for your convenience.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered