Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Error: This page is not using a valid page layout. To correct the problem, edit page settings and select a valid page layout."

$
0
0

I have pages on SharePoint that I have built that are using custom layouts pages. I created the custom layouts in SharePoint Designer, but now I want to make my solution universal...where I can have the code in Visual Studios deploy with those custom layouts pages, so that I won't have to manually create them in Designer each time. 

So far, i can't get my solution to work. Here is what I have done do far...I have added an additional "Module" to my project, and added my custom layout pages to this module. Right now, I am able to deploy the solution, but each time I try to view the pages deployed, I get the error that says "This page is not using a valid page layout.  To correct the problem, edit page settings and select a valid page layout.

Here is what the code in my layouts page module looks like...I am new to doing this, so something tells me that I am doing something wrong here

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"><Module Name="Page Layouts" Url="Page Layouts" Path="Page Layouts" RootWebOnly="False"><File Path="LayoutPage1.aspx" Url="LayoutPage1.aspx" Type="GhostableInLibrary" /><File Path="LayoutsPage2.aspx" Url="LayoutsPage2.aspx" Type="GhostableInLibrary" /><File Path="LayoutsPage3.aspx" Url="LayoutsPage3.aspx" Type="GhostableInLibrary" /></Module></Elements>


And in my code for the pages that should be using the layouts, my code looks like this...

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"><Module Name="Department" Url="pages" Path="pages" RootWebOnly="False"><File Url="Page1.aspx" Name="Page1.aspx" Type="GhostableInLibrary" ><Property Name="PublishingPageLayout" Value="/Page Layouts/LayoutPage1.aspx, LayoutPage1.aspx" /><Property Name="ContentType" Value="Page1" /><!-- Web Parts go here --><AllUsersWebPart WebPartZoneID="Top" WebPartOrder="0"><![CDATA[
        ]]></AllUsersWebPart></File><File Url="Page2.aspx" Name="Page2.aspx" Type="GhostableInLibrary" ><Property Name="PublishingPageLayout" Value="/Page Layouts/LayoutPage2.aspx, LayoutPage2.aspx" /><Property Name="ContentType" Value="Page2" /><!-- Web Parts go here --><AllUsersWebPart WebPartZoneID="Middle" WebPartOrder="0"><![CDATA[
        ]]></AllUsersWebPart></File><File Url="Page3.aspx" Name="Page3.aspx" Type="GhostableInLibrary" ><Property Name="PublishingPageLayout" Value="/Page Layouts/LayoutPage3.aspx, LayoutPage3.aspx" /><Property Name="ContentType" Value="Page3" /><!-- Web Parts go here --><AllUsersWebPart WebPartZoneID="TopRight" WebPartOrder="0"><![CDATA[
        ]]></AllUsersWebPart></File></Module></Elements>


Any ideas why am getting this error? All the pages are configured as ElementFile. I appreciate any help.

I read somewhere that taking out the directives which are added by Designer (since the layouts pages where originally created in Designer), should fix this but it didn't work. I took out thesemeta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document" 

from the markup for the layouts. Am out of ideas at this point...

Thanks.

Update: 

I have now tried to follow this post to build a sample custom layouts page (http://www.c-sharpcorner.com/Forums/Thread/182458/how-to-create-page-layout-in-sharepoint-2010-using-visual-st.aspx), after going through the steps and deploying this, the custom aspx pages do not appear under  "master pages and page layouts". The post says my deployment should save it as a draft, but the aspx is not showing up. Any ideas?


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>