Share via


SharePoint Page Layout Error: Only Content controls are allowed directly in a content page that contains Content controls

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.

Comments

  • Anonymous
    October 13, 2009
    Its Working Great Thanks a lot  

  • Anonymous
    April 17, 2013
    Thanks a lot for the post. Saved my time. Thanks, Rahul Babar

  • Anonymous
    June 24, 2013
    Hi. I had the same warning because I put comments outside of a <as:Content> tag.

  • Anonymous
    August 15, 2013
    Just wanted to re-iterate a "thank you for this post".  Saved me a lot of time in debugging!

  • Anonymous
    March 23, 2014
    Thanks It was really saved around two hours of time... Normally this error don't occur in my page layoyut but when i try to add runat="server'" inside <img tag i faced the problem like you... so baffled and try to dig on it further but it really worked charm after i changed all my <asp:content contentplaceholderID to <asp:Content ContentPlaceholderID Still can't find the real problem what is happening when rendering the page.. it works for sometime even lower case ... (My colleague created one layout without using uppercase in content but it works well not for me..) will update here sooner when i found what' happening around inside...

  • Anonymous
    October 15, 2014
    The comment has been removed

  • Anonymous
    January 27, 2015
    wow...would have never guess this, saved me a bunch of time thanks

  • Anonymous
    February 05, 2015
    Thank you, this saved me a lot of time. I reposted your solution: atia-nuur.de/blog

  • Anonymous
    March 02, 2015
    Cheers mate! Latest update of SP2013 seems to have fixed this issue. Now case doesn't matter I reckon.

  • Anonymous
    April 16, 2015
    Wow!! I came across this issue on my SP2013+SP1+Oct 2014 CU. I can't believe this is still exists. Worst case is there is nothing in ULS logs. You have saved lots of time.. Great tip!!!! Another issue is, I found this is only in Article page layouts.. Custom Page Layouts based on Welcome Page layouts doesn't care about case much.