More in this section

Forums / Designing with Sitefinity / Nested Master Pages

Nested Master Pages

2 posts, 0 answered
  1. Allen
    Allen avatar
    71 posts
    04 Aug 2007
    17 Oct 2007
    Link to this post
    I am using the 3.0 verision and am nesting master pages. 

    I recently had to upload a new "base" master page that includes new functionality, but needed to keep my original "base" around as several sub-masters are inheriting from it and not all will subs will inherit from the new base.  The new "base" master also includes 2 new <asp:content> areas that I filled with controls from inside the Sitefinity admin screen.  All of that went well, but when I changed one of my sub-masters to inherit from the new "base" (had to do this via the file system), the sub-master shows the "base" correctly, but it does not recognize the controls added via the admin GUI (the content container are empty).  Is there a way to "refresh" the sub so that it will recognize the new "base" with the controls or do I need to upload the sub-master again.  If I need to upload it again, will I have to go to each page that uses it (multiple dozens) and reset their template to "sub-master(1)" (or whatever the upload names the duplicate file)?

  2. Slavo
    Slavo avatar
    295 posts
    24 Sep 2012
    17 Oct 2007
    Link to this post
    Hello Allen,

    Currently you can create nested masterpages by setting the MasterPageFile property in the subpage to the name of the base page. Logically this means that the markup from the subpage will be replaced in the base page, where the corresponding ContentPlaceHolder resides.
    Templates in Sitefinity are created from masterpages but they are not masterpages. They are stored in the Sitefinity database and keep references to the controls they contain. Essentially this means that there is no hierarchy in templates, only masterpages.
    What happens in your case is that the base template (created from the base masterpage) keeps a reference to the controls you've put in it. However, this is not the case for the sub. It only knows that it is supposed to show the markup of the parent, and there are no controls in that markup - only a ContentPlaceHolder, which is what you see.

    Unfortunately this is how nested masterpages work in ASP.NET, and if you want to add a control to the base that is also seen in the template created from the sub, you would have to add it in the markup, not through Sitefinity. In this way the control would be created in the file itself and seen from the sub, not in the database. I hope this makes templates and masterpages a little clearer now.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered