SharePoint Designer Support Team Blog

Providing insight on hot and common issues, supportability, and how-to's for Microsoft SharePoint Designer. Coming direct from the support engineers themselves. Read who we are.

How to fix: Error in SharePoint when custom master page is applied

UPDATE: Found this get hit through our support channels several times last week. As it turns out, depending on the missing content placeholder (or other pieces), the cause of the error may be different than just creating new list items; like I previously stated. Therefore, I "genericized" my post to be more applicable to a wider-range of situations. Same steps apply to find what's causing the issue, though. 

Symptoms:

After changing to a customized master page, creating new items for several lists, along with several other operations, no longer works and result in an error message.

Error:

"An unexpected error has occurred."

Cause:

There may be several causes. One, is that the custom master page is missing necessary content place holders.

Resolution:

Method 1: Identify the missing content place holders by modifying the web.config.

  1. Browse to c:\inetpub\wwwroot\wss\virtualdirectories\[port of web application]. Note: in this folder you will find a web.config file.
  2. Open the web.config file in Notepad (or like-application).
  3. In Notepad, click Edit -> Find, enter "custom" (without quotes). Click Find Next. You should find the following node: <customErrors mode="On" />. Change mode from "On" to "Off".
  4. In Notepad, click Edit -> Find, enter "callstack" (without quotes). Click Find Next (change direction Up / Down, if needed). You should find the following node: <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">. Change the CallStack attribute from "false" to "true".
  5. Save the web.config file, and perform an iisreset /noforce.
    • NOTE: After performing the above steps, attempt to reproduce the error in the web browser. The error message should be descriptive in terms of what content place holder is missing. Take note of the place holder name.
  6. Open the master page, and in code view add: <asp:ContentPlaceHolder id="PlaceHolderName" runat="server" />. Replace PlaceHolderName with that of the actual content place holder name that was shown in the error message from step 5.

Method 2: Find the missing content place holders manually.

  1. Open SharePoint Designer 2007. Go to File | Open Site and connect to SharePoint site.
  2. Expand out _catalogs -> masterpage -> open customized master page.
  3. Go to Code view. Go to Edit | Find.
  4. In the Find and Replace dialog, enter: "<asp:contentplaceholder" (without quotes). Click Find All.
  5. Reference the occurrences found in the file with that of available content place holders:
    • PlaceHolderBodyAreaClass
    • PlaceHolderBodyLeftBorder
    • PlaceHolderBodyRightMargin
    • PlaceHolderCalendarNavigator
    • PlaceHolderFormDigest
    • PlaceHolderGlobalNavigation
    • PlaceHolderHorizontalNav
    • PlaceHolderLeftActions
    • PlaceHolderLeftNavBar
    • PlaceHolderLeftNavBarBorder
    • PlaceHolderLeftNavBarDataSource
    • PlaceHolderLeftNavBarTop
    • PlaceHolderMain
    • PlaceHolderMiniConsole
    • PlaceHolderNavSpacer
    • PlaceHolderPageDescription
    • PlaceHolderPageImage
    • PlaceHolderSearchArea
    • PlaceHolderSiteName
    • PlaceHolderTitleAreaClass
    • PlaceHolderTitleAreaSeparator
    • PlaceHolderTitleBreadcrumb
    • PlaceHolderPageTitleInTitleArea
    • PlaceHolderTitleLeftBorder
    • PlaceHolderTitleRightMargin
    • PlaceHolderTopNavBar
    • PlaceHolderUtilityContent
    • SPNavigation
    • WSSDesignConsole
  6. Iteratively add any missing content place holders to the master page in the form of: <asp:ContentPlaceHolder id="PlaceHolderName" runat="server" />. Replace PlaceHolderName with that of the actual content place holder name.
  7. Save master page (Check In, and Approve if necessary) after each added content place holder, and test to see if error still occurs. 

NOTE: In SharePoint Designer 2007, go to View | Toolbars | Master page to bring up the master page toolbar. This may also help in identifying place holders currently used on the customized master page.

Additional Information:

I hope this helps some of you SharePoint branders out there running into similar problems. Certainly, there are few things more frustrating then finding out your beautiful and slick-looking master page is actually causing SharePoint to fail. With that said, I am interested in learning what kind of problems you've ran into with customized master page files with SharePoint, and how you resolved the issues.

Published Thursday, July 10, 2008 2:55 PM by michmon

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Links (7/10/2008) &laquo; Steve Pietrek - Everything SharePoint said:

July 10, 2008 8:31 PM
 

panoone said:

This is such a common problem. We were tearing our hair out trying to work out why any number of things weren't working only to discover it all came down to a couple of missing placeholders and, more importantly, their position on the page.

It didn't matter that we didn't require them, or even that they were hidden. There are clearly inscrutable goings-on behind the secnes that require these placeholders to exist. If they don't, many javascript checks fail and expected functionality is lost.

In our case this primarily affected the appearance and proper use of image libraries but Jed knows what else was being affected.

Simple lesson 1: don't use the minimal master page provided on MSDN. Hence the supplied link to heather Solomon's much improved version above.

Simple lesson 2: Don't delete ANY placeholders. Place them all between an ASP panel wtih visibility set to false, usually somewhere near the end of your page but there is no hard and fast rule for this.

<asp:Panel Visible="false" runat="server">

...

</asp:panel>  

December 8, 2008 6:47 PM
 

Jared said:

I tried these solutions and they didn't work but I did come up with a workaround:

My problem was I was editing on the site instead of locally.

Publish the site to your hard drive.  Then open and edit the files locally and publish remotely.

Once I did this I no longer had problems.

January 20, 2009 1:34 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker