locked
Trying to add my own contentplaceholder in sharepoint 2013 masterpage RRS feed

  • Question

  • hi all,

    I'm new in sharepoint 2013.I'm trying to add my own contentplaceholder in sharepoint 2013 masterpage( near search textbox).  like <asp:ContentPlaceHolder ID="PlaceHolderMain" runat="server"></asp:ContentPlaceHolder> and  
     <asp:Content runat="server" ContentPlaceHolderID="PlaceHolderTopMenu1">   </asp:Content> in my layout. but its not working, nothing is rendered when i refresh my page. I also tried  to add code generated by snippet galary and put it into html page. That also did not work. can you please help me how to add my own contentplaceholder in sharepoint 2013 masterpage.

    Wednesday, May 21, 2014 2:00 PM

All replies

  • Yes you can check below:

    Custom content placeholders on a custom master page

    http://office.microsoft.com/en-in/office365-sharepoint-online-small-business-help/branding-issues-that-may-occur-when-upgrading-to-sharepoint-2013-HA104052656.aspx

    http://technet.microsoft.com/de-de/library/dn178510%28v=office.15%29.aspx

    http://books.google.co.in/books?id=O6sBm5sCEpoC&pg=RA1-PA246&lpg=RA1-PA246&dq=sharepoint+create+own+content+placeholders&source=bl&ots=tNiDN-G26n&sig=WPrJ6AE3O0izKe2d-brZzQJBfhQ&hl=en&sa=X&ei=L7J8U9DyB4qxuASb1IHQCg&ved=0CF0Q6AEwCA#v=onepage&q=sharepoint%20crecreating%20custom%20content%20placeholderscreating%20custom%20content%20placeholders&f=false

    Wednesday, May 21, 2014 2:06 PM
  • Thanks for your response but actually the issue is we jus want to add a custom place holder in master page.

    adding

    <!--CS: Start PlaceHolderTopMenu1 Snippet-->
                    <!--SPM:<%@Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
                    <!--MS:<SharePoint:AjaxDelta ID="DeltaPlaceHolderTopMenu1" IsMainContent="true" runat="server">-->
                    <!--MS:<asp:ContentPlaceHolder ID="PlaceHolderTopMenu1" runat="server">-->
                    <div class="DefaultContentBlock" style="border: medium black solid; background: yellow;
                        color: black; margin: 20px; padding: 10px;">
                        This div, which you should delete, represents the content area that your Page Layouts
                        and pages will fill. Design your Master Page around this content placeholder.
                    </div>
                    <!--ME:</asp:ContentPlaceHolder>-->
                    <!--ME:</SharePoint:AjaxDelta>-->
                    <!--CE: End PlaceHolderTopMenu1 Snippet-->

    this code to master page html and this

     <!--MS:<asp:ContentPlaceHolder ID="PlaceHolderTopMenu1" runat="server">-->
             <div> hello world</div>
             <!--ME:</asp:ContentPlaceHolder>-->

    to layout page shows only a yellow div. But it does not show "hello world" in the page using this masterpage.

    Can anyone suggest how to add  html via a webpart in masterpage header section near search controlbox.

    Wednesday, May 21, 2014 2:44 PM
  • Hi,

    According to your post, my understanding is that you wanted to add your own contentplaceholder in the html master page.

    Before overriding the default page layout, we should first tell the page that the ContentPlaceHolder is being utilised in the Page Layout.

    This is done in the <mso:CustomDocumentProperties> sections.

    You need to add two properties firstly (Below the equalivant for Place Holder Main):

    <mso:ContentPlaceHolderHashPlaceHolderUtilityContent msdt:dt="string">1</mso:ContentPlaceHolderHashPlaceHolderUtilityContent>



    Secondly:

    <mso:ContentPlaceHolderChangedPlaceHolderUtilityContent msdt:dt="string">True</mso:ContentPlaceHolderChangedPlaceHolderUtilityContent>



    Reference: http://sharepointinguniverse.blogspot.com/2013/11/contentplaceholders-and-sharepoint-2013.html

    Thanks & Regards,

    Jason

    Jason Guo
    TechNet Community Support

    Thursday, May 22, 2014 11:22 AM
  • Thanks a lot for your response Jason, it looks like the proper way to add the Custom place holder to the top header section of the master page.

    So that you know, I have created the master page by converting an HTML file in SharePoint 2013 design manager. Following the links, added following two block of code in the master page:

    Following code between<mso:CustomDocumentProperties> tag of master page:

    <mso:ContentPlaceHolderHashPlaceHolderTopMenu1 msdt:dt="string">87884212</mso:ContentPlaceHolderHashPlaceHolderTopMenu1>

    and in body part:

    <div class="container">

                   <!--CS: Start PlaceHolderTopMenu1 Snippet-->
                    <!--SPM:<%@Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
                    <!--MS:<SharePoint:AjaxDelta ID="DeltaPlaceHolderTopMenu1" IsMainContent="true" runat="server">-->
                    <!--MS:<asp:ContentPlaceHolder ID="PlaceHolderTopMenu1" runat="server">-->
                      master page content
                    <!--ME:</asp:ContentPlaceHolder>-->
                    <!--ME:</SharePoint:AjaxDelta>-->
                    <!--CE: End PlaceHolderTopMenu1 Snippet-->

    </div>

    And added the following code in layout page using that  layout page.

    Following code between<mso:CustomDocumentProperties> tag of layout page:

    <mso:ContentPlaceHolderHashPlaceHolderTopMenu1 msdt:dt="string">87884212</mso:ContentPlaceHolderHashPlaceHolderTopMenu1>

    and  in  body part

     <!--MS:<asp:ContentPlaceHolder ID="PlaceHolderTopMenu1" runat="server">-->
             <div> Layout content </div>
             <!--ME:</asp:ContentPlaceHolder>-->

    Unfortunately, the page created from the master page, is not adding any placeholder beside the search control.

    Any idea what I am doing wrong?

    Thanks again for your response in advance.

    Thursday, May 22, 2014 1:40 PM
  • Hi, can you share some guidelines to how to create custom contentplaceholder?

    Thanks,

    Johnweb

    Tuesday, April 21, 2015 4:29 PM