1

I am trying to add a default webpart to PageLayout

I tried using this

<div class="col-3 col-md-3" id="sidebar">
            <WebPartPages:ContentEditorWebPart webpart="true" runat="server" 
                __WebPartId="{76b0ec97-18db-4d84-9d22-b1fc1476d9e6}"
                Title="Quick Links"
                Description=""
                PartImageLarge="/_layouts/15/images/mscontl.gif"
                PartOrder="0"
                ID="g_d2e2e9c9_5554f_4c66_8ab8_07b5ee9d871d"
                ChromeType="TitleOnly"
                ContentLink="/sites/Name/Style Library/Html/Links.html"
                ></WebPartPages:ContentEditorWebPart>
            <WebPartPages:WebPartZone runat="server" Title="RightSideBar" ID="SideBar"/>
        </div>

Now this is present by default when I create pages using this page layout, but there is no delete option for that webpart.

How can I add webpart inside the webpart Zone? I have also exported the content editor webpart as webpart and uploaded it. It would be great if I can add those webparts to the webpart Zone in the PageLayout

0

Try this:

<WebPartPages:WebPartZone runat="server" Title="RightSideBar" ID="SideBar"> 
  <ZoneTemplate>
                 <WebPartPages:ContentEditorWebPart webpart="true" runat="server" 
                __WebPartId="{76b0ec97-18db-4d84-9d22-b1fc1476d9e6}"
                Title="Quick Links"
                Description=""
                PartImageLarge="/_layouts/15/images/mscontl.gif"
                PartOrder="2"
                ID="g_d2e2e9c9_5554f_4c66_8ab8_07b5ee9d871d"
                ChromeType="TitleOnly"
                ContentLink="/sites/Name/Style Library/Html/Links.html"
                ></WebPartPages:ContentEditorWebPart>
</ZoneTemplate>
            </WebPartPages:WebPartZone>

enter image description here

0

Ideally, Webpart should be inside webpart zone. Since in your code you have embbeded your actual webpart code you can't see/edit webpart properties in Edit-page mode.

  1. Open you page layout(i.e. layoutname.html).
  2. Search for "PlaceHolderMain" and Design your page skeleton with HTML & CSS inside this div.
  3. Then insert webpart zone snippet in respective skeleton which you must create using "DesignManager".
  4. click save and publish the pagelayout.
  5. Create a new Page using this pagelayout.
  6. Edit and add what ever webpart you wanted in to respective zone.

Reference for detailed step to create pagelayout using designmanager.

Your Answer

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

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