I've been trying to add a ListViewWebpart to a page layout without success for some days now. I am using a SharePoint 2013 Standard Server with enabled publishing features. I also use the Oslo masterpage.

My goal is to display the same webpart as in the AllItems.aspx of the document library "Documents". But I don't want to have to reconfigure the WebZone for new pages every time to display the desired webpart.

What have I already done?

  • I have created new website columns, a new content type and a related page layout. (has worked)
  • I've made changes in the page layout html file. (has worked)
  • Adding an empty WebPartZone by using the ComponentConfigureControls (has worked, but no webparts can be included by default)
  • Copy the XsltListViewWebPart within the WebPartZone from the Document AllItems.aspx by considering the required pagelayout-html Syntax.

What I mean here is the addition of MS/ME-Tags etc. But that didn't work...

For example:

<!--MS:<WebPartPages: XsltListViewWebPart...<!--ME: <WebPartPages: XsltListViewWebPart>

Out of my desperation I tried the following:

<!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<div xmlns:ie="ie">
    <!--MS:<WebPartPages:XsltListViewWebPart ID="g_843ab260_96cf_4d9c_83c5_6cecdf0791e1" runat="server" ListUrl="Documents" IsIncluded="True" NoDefaultStyle="TRUE" Title="Dokumente" PageType="PAGE_NORMALVIEW" Default="False" ViewContentTypeId="0x">-->

It publishes the web part I was looking for, but apparently, not all dependencies could be loaded, so that after clicking on an element in the list an error was showing. The error message says that there have been problems with rendering.

I give up at this point with the realization that it is obviously not possible to extend a page layout over the HTML/ASPX file to include predefined web parts. However, I would like to have tried once again to have at least asked the question here in this Community whether anyone has already dealt with this in the past and perhaps even succeeded in achieving the above-mentioned objective.

In order to clear up prejudices from the way, I am aware that probably C# solutions would be better suited for this purpose, but SharePoint already offers the possibility to include WebPartZone in ASPX files, so why not include individual WebParts?

I am looking forward to your feedback and look forward to every comment as well as suggestions in any form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.