Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm building out some features for a publishing portal for a client, and I have a requirement to place a Content Editor Webpart on a page and prevent users from deleting, closing, hiding, or moving it. They must only be able to edit the content.

This is really a multi-part question. What's the best approach, and how do I get it to work?

  1. I tried adding the web part directly to a custom page layout - and the web part renders, but is uneditable. Is there a way to do this and have it be editable?
  2. I'm currently trying to add the web part to the page layout inside a webpart zone and set properties to achieve the desired access:

    <WebPartPages:WebPartZone runat="server">
    <ZoneTemplate>
    <WebPartPages:ContentEditorWebPart>
    <WebPart>
    <!-- blah blah -->
    <AllowEdit>true</AllowEdit>
    <AllowRemove>false</AllowRemove>
    <AllowClose>false</AllowClose>
    <!-- etc -->
    </WebPart>
    </WebPartPages:ContentEditorWebPart>
    </ZoneTemplate>
    </WebPartPages:WebPartZone>

  3. Right now I'm still building out the page layout using designer, but ultimately it will be deployed as a module feature. Another approach I've seen is to leave the page layout empty but to add the webpart using the AllUsersWebPart element to configure the webpart when the feature is enabled. I haven't tried this yet, and it sure would be nice if I could get this to work before I get there because if I have to do it that way, my "compile-edit-test" cycle sure does get long and tedious.

share|improve this question
    
If you are using publishing pages, what's the rationale for using a content editor webpart? Sounds to me like you would be better off with the publishing content controls instead. –  Paul Lucas Mar 14 '12 at 22:27
    
@PaulLucas to which controls are you referring? –  Ben Collins Mar 14 '12 at 22:59
    
Assuming you are using the publishing features of SP2010 (page layouts/content types etc), msdn.microsoft.com/en-us/library/ms551164.aspx –  Paul Lucas Mar 15 '12 at 0:08
    
Yeah, ok. That may wind up being the answer. A RichHtmlField is certainly simpler than trying to deploy and restrict a webpart. –  Ben Collins Mar 15 '12 at 3:24
    
Ok... I'll give you a proper answer then :-) –  Paul Lucas Mar 15 '12 at 4:03
add comment

1 Answer 1

up vote 2 down vote accepted

Generally speaking, if you are working with the SharePoint publishing infratructure to create a content managed site, you should be looking more at leveraging the Publishing Field Controls for editing content, rather than content editor web parts.

The following article provides a good understanding of the differences between the two; while it was written for SP2007, most of the info is still relevant to SP2010.

http://msdn.microsoft.com/en-us/library/dd571480(v=office.12).aspx

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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