Thursday, November 17, 2011

Only Content controls are allowed directly in a content page that contains Content controls in sharepoint 2010 page layout

In this post we will discuss how to resolve error: Only Content controls are allowed directly in a content page that contains Content controls in sharepoint 2010 page layout.

Also you can check out my previous posts on:

- How to Configure SSRS for SharePoint Integration Mode in SharePoint 2010?

- Call jQuery to SharePoint page using Content Editor web part

- Script editor web part in SharePoint 2013

I got the error "Only Content controls are allowed directly in a content page that contains Content controls in sharepoint 2010 page layout" while creating page layout using visual studio 2010. What I was doing is I am copying the layout page content from a layout page from SharePoint 2010 designer. so when I was coping and pasting the content, My tags are coming like below

<asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
 <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
</asp:Content>

Please look at the capital letter C in Content, which was causing the problem.

so I have changed the code to small c as below and it works fine.

<asp:content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
 <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>
</asp:content>
<asp:content ContentPlaceholderID="PlaceHolderMain" runat="server">
</asp:content>

No comments:

Post a Comment