1

Is it possible to add a List View Web Part to a custom page layout that is configurable through SharePoint the same way a normal list view web part is configurable? What I mean by configurable, is being able to set the View for the list, edit the view, etc, when a user edits the page through SP UI.

I am only seeing examples to add XsltListViewWebPart which does not appear to meet what I'm looking for.

http://sharepoint-community.net/profiles/blogs/office-365-sharepoint-online-provision-a-publishing-page-with-the This person describes a method of adding a web part through the Elements file, and including a View element, which is interesting and could lead to a solution. However, using his exact example (re-config'd to use a list in my site) nothing ever appears in the page layout.

How to add a XSLT List View Web Part into a Page Layout This example shows how to add an XsltListViewWebPart through the Page Layout's ASPX markup. Using this method, the list view does show up and it looks fine, however, the webpart is not editable at all, even when adding an AllowEdit=True attribute. On top of that, it appears very buggy, not allowing me to add more web parts into its web part zone.

Any ideas?

2
  • I'm not clear on why you're not just adding/inserting the list as a web part directly through the browser.
    – Erin L
    Jan 25, 2016 at 16:17
  • I need to provide a page layout so that I can re-use it as a template. The plan is to have 40+ pages that have the desired webparts already on there when creating the page using the page layout.
    – ferr
    Jan 25, 2016 at 17:30

1 Answer 1

0

Using Elements.xml to provision the webparts ended up working. You still need to use an XsltListViewWebPart, though you add it through a AllUserWebPart. There is a property of the XLVWP that accepts a default view, list name, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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