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 want to develop a webpart that allows editors to amend its content using the built-in rich text editor, and then display that content in a nicely formatted way. The built-in content editor webpart isn't sufficient because I want to wrap the content in hardcoded HTML so as to enforce my site's graphical design. Also, I would like the web part to potentially contain more than one editable area, and the standard Content Editor webpart only has one.

My ideal would be a visual web part with a predefined HTML layout, with some editable "content areas" to allow modification in edit mode. When the webpart is saved it will just render its content areas as HTML. I have tried using <SharePoint:RichTextField> blocks in a visual web part ascx template but I don't think this is correct. Can anyone give advice?

EDIT

One thing I didn't specify was the requirement to add this web-part multiple times, anywhere in the user-editable parts of the page, on an ad-hoc basis. This requirement seems to me to preclude custom-HTML-column-based solutions, but please show me if I'm wrong. I ended up writing my own web-part to solve this problem, see my answer below for that.

share|improve this question
    
This functionality is out of the box with SharePoint Server 2010 Publishing Features. Are you requiring this in Foundation? –  James Love Jul 16 '11 at 17:21
    
No, this was for Enterprise. I basically wanted a "speech bubble" web part that takes some user-provided HTML and wraps it in a formatted speech-bubble HTML container. A key requirement is that the user can add these to the page on an ad-hoc basis, inline in their custom rich text, as many times as they like - I don't think that is available out-of-the-box, correct me if I'm wrong. My final solution is documented here: bit.ly/oTrkxu –  James McCormack Jul 18 '11 at 9:06
add comment

3 Answers

Depending on the content you're looking to display to the user and how you have your user base set up, you could make a web part which displays 'content areas' in which users can input text, etc. Then using Javascript/sharepoint lists you could determine if the current user has already submitted data into the content areas, and show/hide formatted DIVs accordingly (the divs containing the user's submitted information).

Alternatively you could set up a .aspx page (or master page) which hard-codes a content editor web part into a div. From there, you can use CSS to style specific elements in the web part (i.e. img tags, text areas, etc) which the user submits when they save the content editor web part. This should work, but I haven't tested it myself.

Good luck!

share|improve this answer
add comment

From what you have described you need to create custom layout based on the custom content type which itself is based on the publishing page content type. Also you have to add a new column of type "Full HTML content with formatting and constraints for publishing". You can add several depending on your needs. Then you can edit the custom layout in SP designer and add already defined custom content fields there.

So you dont need to creat the new web part. This functionality is out of the box.

share|improve this answer
    
I don't have a Sharepoint instance nearby to check this, but I'm not sure this solves my issue. I basically wanted a "speech bubble" web part that takes some user-provided HTML and wraps it in a formatted speech-bubble HTML container. A key requirement is that the user can add these to the page on an ad-hoc basis, inline in their custom rich text, as many times as they like. Your solution seems to be more rigid and would require new columns to be created per speech bubble - correct me if I'm wrong. My final solution is documented here: bit.ly/oTrkxu –  James McCormack Jul 18 '11 at 8:59
    
IMHO you could use Reusable Content for that. But as far as you solution works for you than its ok :) –  AlexSSE Jul 19 '11 at 10:07
    
Ah sorry I'm not explaining it very clearly. The user-provided content for the speech bubbles is ad-hoc and unique in every instance - so I can't use Reusable Content. Thanks anyway, have a +1 on me. –  James McCormack Jul 19 '11 at 10:11
add comment
up vote 0 down vote accepted

I eventually wrote my own custom web part to solve this problem. See here: http://zootfroot.blogspot.com/2010/09/develop-custom-editable-visual-web-part.html

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.