Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

3. Using Master Pages > Modifying Master Page Properties from the Template File

Modifying Master Page Properties from the Template File

You may have noted that the master page<title /> element contained the text Untitled Page. Properties such as this can be modified from within the template file. Let’s set the<title /> element and the litHeader control to the MCMS Posting Display Name:

  1. In Solution Explorer, right-click the Plant.aspx file, and click View Code.
    • Add the following using statement:
      using Microsoft.ContentManagement.Publishing;
      
    • Enter the following code within the Page_Load() method of the template file:
      string displayName = CmsHttpContext.Current.Posting.DisplayName;
      Master.Page.Title = displayName;
      litHeader.Text = displayName;
      

      Note

      Code to manipulate master page properties can also be placed in the master page.

    • Save your work, and from the Build menu, choose Build Web Site.

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint