I recently built a SharePoint feature to provision custom master pages and page layouts for a client. Overall the solution worked pretty well until one day, while making changes to one of the page layouts, I saw the following error: Only Content controls are allowed directly in a content page that contains Content controls.
Since other blog entries, referenced at the end of this article, can explain the background I'll get right to the cause and the solution. The cause is improper case for the <asp:Content> control tags in my page layout. A few contorls used a lower case "c" instead of an uppercase "C" in the word content. The page layout that had trouble had tags that looked like: <asp:content> instead of <asp:Content>. The specific offending tag is the one associated with the page title (<asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">). The solution was as simple as correcting the case of the tag name and all worked well.
Here's an example of the symptom I saw. Errant code is inserted in the page layout after it's deployed to the master page library in SharePoint and result is an error when trying to render the page; this errant code will not appear in the source, but you'll see it if you open the layout in SharePoint designer from the master page gallery:
<META name="WebPartPageExpansion" content="full">
<!--[if gte mso 9]><xml>
<mso:ContentType msdt:dt="string">Page Layout</mso:ContentType>
<mso:PublishingAssociatedContentType msdt:dt="string">;#Agenda item;#0x010100C568DB52D...;#</mso:PublishingAssociatedContentType>
<title>Dummy Content Type</title></head>
SOURCE: Tech MOSS Team blog on SharePointBlogs.com
Where I found my solution:
Both of these blog articles were older entries, but they saved many more hours of work. Thanks to both Rich and Waldek!
This is very good post and i could solve the same issue.
Thank you very much...
Post a Comment