Monday, December 21, 2009

Error: 'Only Content controls are allowed directly in a content page that contains Content controls'

I got this error while I’m working on Intranet Portal SharePoint Project, we have created many custom site definitions, list definitions, content types and Page Layouts in this project.


Whenever we create sites based on our custom site template, and after the creation completes, I got this error:
“Only Content controls are allowed directly in a content page that contains Content controls”.
Note that all internal pages were working fine (Site Settings page, All site content page,….etc).

So finally it was a problem caused by Page Layouts, also some page layouts were working fine and some are not.

I opened the corrupted page layouts in SharePoint Designer, and found that below lines have been appended to the end of the page, and if I remove them the corrupted page layout works fine !!!!




Still one thing to do !! what caused this generated code to be appended? so I made a  comparison between corrupted layout pages and the working ones, I found just below difference:




All letters in above two tags were written in lowercase, and after change them back as in the above ones (capital 'C' in "Content"), and tested the above scenario again (created same sites again), everything worked fine and I never get this error again.

3 comments:

  1. Thanks for the help, and i hope to get rid of SPD generated code (Wish to find it in 2010)

    ReplyDelete
  2. Howdy! Someone in my Myspace group shared this site with us so I came to check it out.
    I'm definitely enjoying the information. I'm bookmarking and will
    be tweeting this to my followers! Superb blog and superb design.


    Have a look at my blog post referencement site ()

    ReplyDelete
    Replies
    1. Thanks a lot my friend, its my pleasure that you find some useful info here.
      Actually it has been long time since my last post, but we will be back posting here soon.

      Delete