Sunday, November 4, 2007

Nested Master Pages in SharePoint - Troubleshoot

Recently one of my customers needed to maintain basic layouts rules while allowing different solution creators in his company to generate new master pages for their applications.

Naturally - we looked for nested master pages.

This solution would allow us to create a parent master page that all other master pages will inherit and apply our branding and design rules with very little effort.

Problem was that when I tried to inherit blueband.master into child.master things did not work.
The ASPX page that was using child.master could not enter edit mode, and I could not add / remove nor edit web parts in it.

After reading another post on the internet - I accidently found the solution – unghosting the master pages will solve this issue and nested master pages will start working!

All I had to do to make this work is to unghost blueband.master by opening it in SharePoint Designer and saving it – so it was customized.

Done!

So to create a sub master page to blueband.master that only supports editing the PlaceHolderMain area add this code to child.master:


<?xml:namespace prefix = asp /><asp:content id="Content1" runat="server" contentplaceholderid="PlaceHolderMain">
<asp:contentplaceholder id="PlaceHolderMain" runat="server"></asp:contentplaceholder>
</asp:content>

Hope this helps you guys… Good luck.

2 comments:

Swaminathan said...

I dont see the code to be pasted in child.master

Shai Petel said...

Thanks, I updated the entry to show the code.

for some reason everytime i post encoded xml samples after a while they get changed to real tags and become invisible...