Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How is it possible to add a XSLT List View Web Part into a Page Layout? I want to do this basically so that instead of adding the web parts I want to multiple pages, I can just apply the specific page layout with the web part attached so its automatically added.

Current scenario I am doing is like this:

  1. Add a Page / Publishing Page.
  2. Insert a List View Web Part into that Page and save.
  3. Access SPD 2013 and extract the declaration for that web part.
  4. Go to Design Manager in SP2013 Browser and add a Page Layout.
  5. Edit the Page Layout and generate "Custom ASP.NET Markup" for inserting into HTML the code extracted for the declaration of the web part.
  6. Go to SPD 2013 and access and edit the created Page Layout HTML file.
  7. Insert the generated code snippet inside the Content Placeholder Main markup on the HTML file.

However, this does not work properly! I get the error "SharePoint can't parse this file, most likely because of an incorrectly formatted SharePoint snippet. The markup at the following location is causing problems. Edit the markup manually to fix it, or replace it with a new snippet from the Snippet Gallery. {Type of error, location of error}. Occurred at: {Time}."

There must be something wrong with the process I am doing. I can't find any resource on the internet and I am stuck. Please help! Thank you!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Firstly you need to be cautious adding a LVWP to a page layout as it could potentially be used on a different site to the location of the list. If this is the case then you should use a CQWP or in 2013 a Search web part which will not cause any issues across sites.

I do not have much experience with 2013 yet but with 2010 I can add web parts directly to the page layout - is that not possible in 2013?

The other option I have used in 2010 is to export a web part and then add it to the gallery where it can then be added to any page including the page layouts - again perhaps this is not possible in 2013?

share|improve this answer

You must add this code inside a webpart zone:

<WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart2" 
    runat="server" ListUrl="Lists/PublicDocuments" IsIncluded="True" 
    NoDefaultStyle="TRUE" Title="Public Documents" PageType="PAGE_NORMALVIEW" FrameType="None"
    Default="False" ViewContentTypeId="0x"> 
</WebPartPages:XsltListViewWebPart>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.