Custom Content Type and Rich Text
Ok so here is my scenario:
I’m developing a custom SharePoint solution that includes …
- a custom content type
- numerous fields including RichText enabled fields
- list template
- a custom control template for my new/edit/display forms
The problem:
Everything was rendering perfectly except my RichText fields.
The solution:
Define your field and reference it in the ContentType xml file
<Field ID="{D5C2A287-02B5-47b1-9865-AC8300A00E86}" Name="MyRichTextField" StaticName="MyRichTextField" DisplayName="My RichText" RichText="TRUE" RichTextMode="FullHtml" Type="Note" Hidden="FALSE" />
Remember to put this field definition also in the schema.xml file
In your control template simply write
<SharePoint:FormField FieldName="MyRichTextField"
runat="server" />
That’s it. My headache was because I had forgot to update the field definition in the schema.xml file with my rich text parameters.
And also if you would like to control the richtext fields width for example. Override the .ms-rtelong style with your preferred width like
.ms-rtelong { width: 100%; }
Best regards,
Sigurbjörn
- SharePoint
2 Responses
[...] public links >> richtext Custom Content Type and Rich Text Saved by rbanerjee on Thu 13-11-2008 Getting MaxLength Validation to work with CFTEXTAREA… [...]
Это правда….
Няня Name=”MyRichTextField”
StaticName=”MyRichTextField”
DisplayName=”My RichText”
RichText=”TRUE”
[…..