SharePoint - using the rich text box in a custom user control

Frustration aplenty with this one. Logic dictated that the RichTextField control in SharePoint would have been the one to use...

but no, it's not (as i found out)...so how do you use that shiny nice Rich Text Box control in a custom web part or user control.

richtextbox

simple - so simple i'm sad to say it took me 1 1/2hrs discussing it with some like-minded fellows before we found out what it was (sad i know, but we got there in the end).

Add this to your ascx (if you're using a web user control):

   1: <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

and here comes the simple bit..

   1: <SharePoint:InputFormTextBox runat="server" ID="RichTextBox" ValidationGroup="CreateCase" Rows="8" Columns="40" RichText="true" RichTextMode="FullHtml" AllowHyperlink="true" />

That's it...not that impressive but that's what you have to do..simple eh :)

Note: this is only available in MOSS 2007.

Published Friday, March 14, 2008 8:56 AM by Brian Madsen
Filed under:

Comments

# http://sharepoint-blogs.com/

Wednesday, March 19, 2008 7:13 PM by TrackBack

# re: SharePoint - using the rich text box in a custom user control

Hi

I am using RichTextBox inside a Smartpart.

This control is bound inside with DataList Control.

When I am editing the Row of datalist control,I want to display the same.

RichTextBox controls is rendering fine with the RowEdit event.But the problem with the width.

Evenif we set the width property to the control,the width is not changing.

Wednesday, March 26, 2008 8:11 AM by Karthikeyan,K

# re: SharePoint - using the rich text box in a custom user control

Use the Rows and Columns properties to set the height and width of the Rich Text Box control.

Wednesday, March 26, 2008 4:30 PM by Brian Madsen