Skip to content

Example of RichTextEditorFor in ASP.NET MVC Rich Text Editor Control

This sample demonstrates the strongly-typed extension support in Rich Text Editor control. The value of the Rich Text Editor is set from code behind and it is set to Rich Text Editor in a view page by invoking the strongly-typed RichTextEditorFor helper.

Html.UiRichTextEditorFor(m => m.Body): the field's name, value and rules come from the model. The action binds the post with UiHtmlModelBinder, which makes the [AllowHtml] body safe before the action sees it; try a <script> in the source view and post.

Click the submit button to post the value in the Rich Text Editor. The validation error message will be shown below the Rich Text Editor, when posting the null value.