Clicky

Whats the code snippet for adding a default content editor webpart to a custom pagelayout?

asked 12/17/2011 04:48

MickMorg's gravatar image

MickMorg ♦♦


1 Answers:
Hello,

Are you looking for a coding solution? It is not clear from your question. If not, read on.

Best way to go about this is to open the page layout in SharePoint designer. At the place where you want the CEWP, add a div tag. Change to design view and select the new div. Then click Insert > Web Part > Content Editor Web part. Go back to code view and study the code. It will look something like


1:
2:
3:
4:
5:
6:
<div><WebPartPages:ContentEditorWebPart webpart="true" runat="server" __WebPartId="{0C023812-0992-4428-B562-1F510E9F42D9}"><WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
	<Title>Content Editor</Title>
	<Description>Allows authors to enter rich text content.</Description>
	<PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
		<ID>g_0c023812_0992_4428_b562_1f510e9f42d9</ID>
</WebPart></WebPartPages:ContentEditorWebPart></div>


Mind that each web part will have its own unique ID, so you cannot just copy and paste the above.

Hope that helps,

teylyn
link

answered

teylyn's gravatar image

teylyn

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×102
×17

Asked: 12/17/2011 04:48

Seen: 257 times

Last updated: 12/17/2011 05:51