none
How to add summary link web part to custom Page Layout Pro-grammatically in sp2013 ? RRS feed

  • Question

  • Hi,

    I have a custom page layout in Visual studio.If i create a new page using this custom layout, i have to add Summary Links webpart to be added to the page. First time it will be in Hidden in the page. Once add the links to webpart then only i have to see it in the page.

    I have the below webpart zones available in my layout page.

     <div class="col-xs-12">
                        <WebPartPages:WebPartZone runat="server" Title="Top Zone" ID="TopZone" BorderStyle="None" PartChromeType="None"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
                    </div> 

     <WebPartPages:WebPartZone runat="server" Title="Business Content Zone"  ID="BusinessContentZone" BorderStyle="None" PartChromeType="None"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

    I have to show SummaryLink webpart to the newly created page.how to add it in the above template.>pls help

    Wednesday, February 13, 2019 7:11 AM

All replies

  • Hi

    Here is a reference for you and hope it can help.

    https://stackoverflow.com/questions/31229284/how-to-embed-sharepoint-2013-webparts-directly-in-aspx-layout-page-as-default-we


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Wednesday, February 13, 2019 7:20 AM
  • I need this code for Summary Link webpart. How to add in layout page?

    please provide.


    • Edited by sudhir muvva Wednesday, February 13, 2019 9:05 AM
    Wednesday, February 13, 2019 8:47 AM
  • Hi

    You can open your page layout with SharePoint Designer in Advanced Mode.

    And add a summary link webpart to get the code.

    Here is an example from mine.

    <PublishingWebControls:SummaryLinkWebPart runat="server" SummaryLinkStore="" EnableOriginalValue="False" ViewFlag="0" ViewContentTypeId="" ListUrl="" ListDisplayName="" ListId="00000000-0000-0000-0000-000000000000" PageSize="-1" UseSQLDataSourcePaging="True" DataSourceID="" ShowWithSampleData="False" AsyncRefresh="False" ManualRefresh="False" AutoRefresh="False" AutoRefreshInterval="60" NoDefaultStyle="" InitialAsyncDataFetch="False" Title="$Resources:cmscore,SummaryLinkWebPart_Title" FrameType="TitleBarOnly" SuppressWebPartChrome="False" Description="$Resources:cmscore,SummaryLinkWebPart_Description" IsIncluded="True" ZoneID="" PartOrder="1" FrameState="Normal" AllowRemove="True" AllowZoneChange="True" AllowMinimize="True" AllowConnect="True" AllowEdit="True" AllowHide="True" IsVisible="True" DetailLink="" HelpLink="" HelpMode="Modeless" Dir="Default" PartImageSmall="" MissingAssembly="$Resources:cmscore,WebPartImportError" ImportErrorMessage="$Resources:cmscore,WebPartImportError" PartImageLarge="" IsIncludedFilter="" ExportControlledProperties="True" ConnectionID="00000000-0000-0000-0000-000000000000" ID="g_9b6ffe1b_fb44_4f82_aa97_3c14dba2cf84" ChromeType="TitleOnly" ExportMode="All" __MarkupType="vsattributemarkup" __WebPartId="{9b6ffe1b-fb44-4f82-aa97-3c14dba2cf84}" WebPart="true" Height="" Width=""><Xsl>
    <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime" exclude-result-prefixes="xsl cmswrt x" > <xsl:import href="/Style Library/XSL Style Sheets/Header.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/ItemStyle.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/SummaryLinkMain.xsl" /> </xsl:stylesheet></Xsl>
    <SampleData>
    <dsQueryResponse>
                        <Rows>
                            <Row Title="Group Header" Order="1" BeginColumn="True" IsGroupHeader="True" />
                            <Row Title="Item 1" LinkUrl="http://Item1" Group="Group Header" Order="2" BeginColumn="False" IsGroupHeader="False" />
                            <Row Title="Item 2" LinkUrl="http://Item2" Group="Group Header" Order="3" BeginColumn="False" IsGroupHeader="False" />
                            <Row Title="Item 3" LinkUrl="http://Item3" Group="Group Header" Order="4" BeginColumn="False" IsGroupHeader="False" />
                        </Rows>
                        </dsQueryResponse></SampleData>
    <DataFields>
    </DataFields>
    </PublishingWebControls:SummaryLinkWebPart>


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Wednesday, February 13, 2019 9:14 AM
  • Above code is not working.

    Its showed only the tilte when create a new page using custom Layout.

    My Requirement is in page edit mode, i have to add the links.

    • Edited by sudhir muvva Thursday, February 14, 2019 6:46 AM
    Thursday, February 14, 2019 5:25 AM
  • Please try to edit your own page layout file in SharePoint Designer, add the webpart and edit the links.


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.


    Thursday, February 14, 2019 7:52 AM
  • Hi Sudhir,

    You can create a web part page and add summary link web part to the page, then open the page using SharePoint designer, and then copy the web part code and add into the web part zone.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, February 14, 2019 7:54 AM
    Moderator
  • Hi,

    Would you please provide us with an update on the status of your issue?

    Best Regards,
    Dennis

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, February 18, 2019 8:28 AM
    Moderator