Using RichTextEditor in ASP.Net MVC

RichTextEditor for MVC is by far the fastest, cleanest, most powerful online wysiwyg content editor. It enables MVC web developers to replace any textbox/textarea with an intuitive word-like wysiwyg html editor.

In this article we will discuss how to use RTE with ASP.NET MVC. The sample applications using the Razor view engine are included in the download package.

Demo Download


1. Install the assembly

Copy the following files to your application bin folder.

  • richtexteditor.dll
  • NetSpell.SpellChecker.dll
  • richtexteditor.lic

The "richtexteditor" folder and all files it contains should be deployed to the directory of your MVC website.

2. Add Uploader httpModule to web.config's httpModules list

To allow RichTextEditor to upload big files, you need to add Uploader HttpModule to your application.

IIS 5.0, 6.0 and IIS 7.0 Classic mode

      <add name="UploadModule" type="RTE.UploadModule,RichTextEditor"/>

IIS 7.0 Integrated mode

      <add name="UploadModule" type="RTE.UploadModule,RichTextEditor"/>

3. Using the Editor in a MVC page (.cshtml)

a. Register RichTextEditor control in MVC controller and use Editor.LoadFormData method to load content into the RTE

Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Editor1");
Editor1.LoadFormData("Type here...");
ViewBag.Editor = Editor1.MvcGetString();

b. Insert a RTE instance into the page


Download ›