Following is the code in my page layout.

<WebPartPages:WebPartZone id="page_detail" runat="server" title="Page Detail" PartChromeType="None"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

Is it possible to add a default web part here so when the page loads, that web part is already there rather than user has to click on "Add a web part" link?

I would like to add Content Editor web part here.


2 Answers 2


I've always done this with SharePoint Designer (SPD) when I needed to accomplish the task. If you have access to SPD, here is the lowdown:

  • Edit the layout in Advanced Mode
  • Make any of the surrounding HTML edits you need and save the layout.
  • Go to Insert tab > click on Web Part Zone
  • I usually hit enter for readability, which means you have to save again.
  • Go to Insert tab > click on Web Part (dropdown) and select the WP you want to insert.
  • Save again.

That should do it. You will wind up with something like this:

<WebPartPages:WebPartZone id="g_A48E6AA09E6A4497AB23C22C6247DBBE" runat="server" title="Zone 1">

                    <WebPartPages:ContentEditorWebPart webpart="true" runat="server" __WebPartId="{4C1491E9-30FA-48A2-80EA-BEB4171B84EC}"><WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">


A few things of note: - Saving the layout and coming back into it will populate a few more properties that you can edit, such as Chrome Type. It also provides the content area where you can add pre-populated content to the content editor if you wish. See this Stack post for how that is done.


Try to add this code to the page. This works for me in a master page but I didn't try in a page layout

<asp:WebPartManager ID="WebPartManager1" runat="server"/>
    <asp:WebPartZone ID="WebPartZone1" runat="server">
            <WebPartPages:ContentEditorWebPart ID="ContentEditorWebPart1" runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{put your guid here}" >
               <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
                  <Title>Content Editor</Title>
          <Description>Allows authors to enter rich text content.</Description>
          <DetailLink />
          <HelpLink />
          <PartImageSmall />
          <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
          <IsIncludedFilter />
          <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
          <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
          <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">PUT YOUR CONTENT HERE</Content>
          <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />

Good Luck

  • Not working in page layout. It is showing error "The control type 'System.Web.UI.WebControls.WebParts.WebPartManager' is not allowed on this page." Commented Aug 5, 2013 at 6:36
  • Did you try to insert just the web part to the web part zone? Sounds like you are trying to copy the web part manager tag along with the rest of the code in this answer Commented Oct 21, 2016 at 1:30

Your Answer

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

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