Mohamad A Sallal Blog

SharePoint – Only Content controls are allowed directly in a content page that contains Content controls

I was working on SharePoint migration from 2010 to 2016 for a customer today. I checked some custom page layout using Visual studio and created a new page based on the page layout. Suddenly the publishing page throwing this error

Only Content controls are allowed directly in a content page that contains Content controls“.

SharePoint Page layout error: Only Content controls are allowed directly in a content page that contains Content controls

Solution


I double checked the page layout. There was no html elements inside it. Everything is placed under the ContentPlaceHolder.

The cause is improper case for the <asp:Content> control tags in my page layout.  A few contorls used a lowercase “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”>). 

<asp:content placeholderId="PlaceHolderPageTitle" runat="server"></asp:content>

as well as asp:contentplaceholderId should be uppercase like this

<asp:content placeholderId="PlaceHolderPageTitle" runat="server"></asp:content>


I just changed the ‘c’ in the contentplaceholder

Note

if you are deploying the solution and still have the same issue, the layout might be locked by the SP designer, open the layout using SP designer and modify the same changes

Thanks


Exit mobile version