Skip to content

Modify the default.master so it can be used as the application.master

November 20, 2010

The SharePoint application pages (under the _layouts folder) use the application.master master page and not the defaul.master. This can be quite painful because not only the “admin” pages use this master page, but pages like Recycle bin, View All Site Content, etc. It is a common user request to have a consistent branding throughout the site so we will need to modify this master page, too. (of course, we should remember that this page is common for all sites on the SharePoint server, so if we have several web applications, we should think twice before modifying this page)

If we simply copy the content of the default.master to the application.master then we lose some functionality because two ContentPlaceHolder controls that are needed for the application.master are not in the default.master. However it causes no issues if we add these ContentPlaceHolders into the default.master, too. If we do that, we will have a common master page that we can use either as the default or the application master page.

The missing placeholders are the  PlaceHolderPageDescriptionRowAttr and the PlaceHolderPageDescriptionRowAttr2. They should be placed above the main content placeholder (PlaceHolderMain) so you can modify your default.master like this:

Find the following section in your default.master:


    <PlaceHolder id="MSO_ContentDiv" runat="server">
  <table id="MSO_ContentTable" width=100% height="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td class='ms-bodyareaframe' valign="top" height="100%">
      <A name="mainContent"></A>
    <asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat="server"/>
    <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server">
    </asp:ContentPlaceHolder>
    </td>
    </tr>
  </table>
  </PlaceHolder>

And replace it with this. (if you already modified your default.master, make sure you don’t overwrite our changes)

 <placeholder id="MSO_ContentDiv" runat="server">
    <table id="MSO_ContentTable" width=100% height="100%" border="0" cellspacing="0" cellpadding="0">
        <asp:ContentPlaceHolder id="PlaceHolderPageDescriptionRowAttr" runat="server"/>
            <TD width="100%">
            <asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat="server"/>
            </TD>
        </TR>
        <asp:ContentPlaceHolder id="PlaceHolderPageDescriptionRowAttr2" runat="server"/>
           
<td id="onetidMainBodyPadding" height="8px"> </td>
<IMG SRC="/_layouts/images/blank.gif" width=1 height=8 alt="">
        </TR>
        <tr>
            <td class='ms-bodyareaframe' valign="top" height="100%">
                <A name="mainContent"></A>
                <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server">
                </asp:ContentPlaceHolder>
            </td>
        </tr>
    </table>
</placeholder>

Now you have a master page file that you can use either as your default.master or application.master. That can make much easier to have a consistent branding on the site. I’m just wondering why Microsoft couldn’t have a same master page for the whole site, or at least two master pages but with the same placeholder structure…

Advertisements

From → MOSS 2007, WSS 3.0

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: