Sharepoint Rich Text box in Webparts

In my current project, I have to develop a webpart, in which users should able to Add / enter comments using Sharepoint native rich text box. I have tried, RichTextField, I am able to add it, but while rendering it is giving a lot of problems like, Control mode not set etc.

After some “google”ing I found some other control, the InputFormTextBox, using this, I am able to create a webpart, which uses sharepoint default Rich Text Editor.


InputFormTextBox txt = new InputFormTextBox();
txt.TextMode = TextBoxMode.MultiLine;
txt.RichText = true;
txt.RichTextMode = SPRichTextMode.Compatible;

And you can use txt.Text property to read the contents of the Textbox. I am adding / inserting the Text to a multiline column in a custom list.

No related content found.

This entry was posted in .Net, sharepoint. Bookmark the permalink.

5 Responses to Sharepoint Rich Text box in Webparts

  1. John P says:

    Hi,
    I’ve been trying to get this Rich Text control working in a custom aspx page. The control renders, but without the rich text editing ribbon on the top. It just looks like a normal multiline textbox. My code for this is below if you’ve got any idea why this is happening I would very much appreciate any help. Thanks in advance

    Assembly Reference:

    Control Definition:

    John P.

  2. anuraj says:

    Hi John

    I am unable to see your code. :(
    And I was done in WSS 3.0, C# and .Net 2.0 and in Custom WebPart, not in a page. Anyway if you can please give me the code, I will try to look into it.

  3. Aliuon says:

    Hi Anuraj

    We have created a webpart with a rich textbox using the same code as your post. But we found the rich textbox’s some functionalities are not the same as the Sharepoint default CEWT rich textbox. For example, we can’t upload the images using our custom webpart but it is ok in Sharepoint default CEWT. Do you have any idear to set all the custom webpart’s functions to be same as the Sharepoint default’s?

    Thanks,

  4. Aliuon says:

    Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>