0

I have created a custom page layout by copying an existing one and then adding the HTML code inside the code below, and then uploading the resulting .aspx file into the layouts folder:

<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
    HTML code here - tables, pictures etc.
</asp:Content>

It works fine, but the problem is that I want to allow users to add web parts into this page by clicking "Edit" in the SharePoint web interface and clicking "Web Parts" on the ribbon.

However, it seems that the entire page is read only. You cannot add modify any text and cannot insert any webparts. Nothing happens when you try to click any area of the page.

I've tried inserting this (found on MSDN) but it didn't help, this section still appears read only in page edit mode:

                        <!-- webpart zone -->
                        <div data-name="WebPartZone">
                            <div xmlns:ie="ie">
                                Webpart zone is here
                            </div>
                        </div>

I've tried searching but all articles seem to talk about something completely irrelevant, creating page layouts using GUI inside SharePoint, or allowing users to input field values.

So the question is, how do I allow users to add webparts into the custom layout that I've made?

UPDATE: I've managed to add an editable area into the page by adding this code (and I can insert the web part there):

<PublishingWebControls:RichHtmlField 
FieldName="PublishingPageContent" HasInitialFocus="True" 
MinimumEditHeight="200px" runat="server"/>

The webpart displays fine while in the edit mode.

However, when I save the page and leave the edit mode, the web part disappears.

1 Answer 1

0

Add following content

  <WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager"></WebPartPages:SPProxyWebPartManager><p></p><WebPartPages:WebPartZone id="g_4B599F837F1947658A5EBD58D0CB8D5A" runat="server" title="Zone 1">

or Use following steps.

  1. Open Page Layout in Designer in edit mode.
  2. Place you cursor,Where you want to pase webpart zone.
  3. Click on "Insert" tab in ribbon.
  4. Click on "Webpart zone"

Your Answer

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