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 (10)

  1. Nirmal Kumar says:

    Its Working Great

    Thanks a lot  

  2. Rahul Babar says:

    Thanks a lot for the post.

    Saved my time.

    Thanks,

    Rahul Babar

  3. Loic says:

    Hi. I had the same warning because I put comments outside of a <as:Content> tag.

  4. Sam P says:

    Just wanted to re-iterate a "thank you for this post".  Saved me a lot of time in debugging!

  5. Magesh says:

    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…

  6. KK says:

    Excellent you saved my day sorry days.

    we are just banging our heads to fix this without any clue..

  7. Chris says:

    wow…would have never guess this, saved me a bunch of time thanks

  8. Lea says:

    Thank you, this saved me a lot of time.

    I reposted your solution: atia-nuur.de/blog

  9. Praveen Kumar Thalluri says:

    Cheers mate! Latest update of SP2013 seems to have fixed this issue. Now case doesn't matter I reckon.

  10. Nik Patel says:

    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.

Skip to main content