dotnet thoughts 

a dotnet developer's technical blog

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.