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

In SharePoint 2010, when using SharePoint list and column type "multiple line of text" with Enhanced Rich Text option (which allows inserting images, html code etc.), how can I enable to allow inserting one or more SharePoint Web parts ?

share|improve this question
add comment

5 Answers

up vote 6 down vote accepted
+100

Interesting Question.

I think a better approach is to Create Custom List Column Type that can work as per your business logic. If you still need to use rich text column, please continue reading... :-)

Traditional Webparts are actually server side controls which are processed by SharePoint(actually ASP.NET) runtime and the corresponding HTML markup is generated and embedded in the requested Page.This HTML is then processed by browser and the webpart is displayed to user.

Now, If you can manage to get the HTML of the webpart (copy from view source) and insert into the rich text column, it will work.However, it will be static - which may not serve the purpose

To have dynamic HTML, you can try using the client side techniques ( instead of server side, like webpart).Below are some ways:

  • JavaScript\ICallBackEventHandler :From example provided in the link, You can just place the <span id="Message"></span> in the rich text list column and dynamically feed the html response you get via callback.

  • Jquery\WebServices : You can code your own webservice and call it via Jquery to get the HTML response or use SPServices library.

  • ECMAScript client object model

To make above methods working, you will need to insert scripts outside the rich text list column, because the OOTB list column don't allow to insert scripts(for security purpose). To have them inside,you can create a custom rich text column to allow scripts

share|improve this answer
add comment

You can't insert a Web Part into a SharePoint list. SharePoint does not work that way. You add SharePoint Web Parts to a Web Part Page.

share|improve this answer
    
I see I can not do it by default, however what can I do to enable this feature, do I need to program something in Visual Studio, or use SharePoint designer to enable desired feature ? thank you –  hkusulja Dec 16 '12 at 18:07
    
My understanding is that you can't, there is no feature that can be enabled to allow this. SharePoint Web Parts contain code associated with them. The Rich Text option only will contain text (although it may have markup). –  Mark Dec 16 '12 at 21:26
    
I understand, but I need this feature if possible :/, so I am asking directions where to search for help how to develop such a feature. Thank you –  hkusulja Mar 16 '13 at 15:23
add comment

I don't think that it is possible to put web part into rich text field. Maybe you can tell us more about what you need to do and we can advice you alternative way?

share|improve this answer
add comment

By default enhance rich text's features like (html,image etc) are totally different from webparts. For any SharePoint field there are 4 areas considered main in terms of interaction with user:

  1. Add/Remove area for that field (in List settings)
  2. List Item Add/Edit form
  3. List Item Display form
  4. List views

Even if some way you are able to insert webparts in rich text.. your list item display form and list view will create big mess on screen.

Adding webpart on rich text means you want to do some business function .. to show processed data .. another way are you seeking for KPI or some sort of calculated fields ?

Unless you can clarify the usage , what you want to achieve by inserting webpart in rich text no one can help you more.

share|improve this answer
add comment

Here are my two cents. Before we start though, know that I would avoid with all my strength to actually have to code what I will describe. I fear that this awake Cthulhu from his sleep in the sunken city of R'lyeh.

Anyway you could try to start from a custom field type, as Amit Kumawat suggested here. I would avoid trying to generate the webpart html and store it in the field though. What I would do is saving the web part export data in the field: that would be a string - so there shouldn't be any problem.

You would then need to have the web part rendering on the page. I believe that you could do that by abusing the rendering control for your custom field type. Have it return render a web part instance when in view mode (notice: that could be hard but you should be able to, creating the instance from the template isn't hard). In edit mode... you could try to render the web part tool part? again you should be able to get it from the web part instance - but then you would need some way to save the modified properties to the backing field.

Also worth a notice would be that your "field" would basically break almost any standard out of the box view inside SharePoint: just think the view item form with a web part inside it. And I'm not even considering other problems: connections, relative urls, web part that interact with data and so on.

Again, I would try to avoid this. If I may give you an advice, I would try to question the needs for a similar solution. Is this a customer request? Are you sure that your customer is describing what he need and not what he believe to need?

Note: leave a comment here if you need some more info. Also, feel free to add some more details on why you must have to do this.

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.