Hi,
below is the code of it, you also can find it from the mvc demo controller file.
- protected Editor PrepairEditor(Action<Editor> oninit)
- {
- Editor editor = new Editor(System.Web.HttpContext.Current, "editor");
-
- editor.ClientFolder = "/richtexteditor/";
- editor.ContentCss = "/Content/example.css";
-
-
-
- editor.Text = "Type here";
-
- editor.AjaxPostbackUrl = Url.Action("EditorAjaxHandler");
-
- if (oninit != null) oninit(editor);
-
-
- bool isajax = editor.MvcInit();
-
- if (isajax)
- return editor;
-
-
- if (this.Request.HttpMethod == "POST")
- {
- string formdata = this.Request.Form[editor.Name];
- if (formdata != null)
- editor.LoadFormData(formdata);
- }
-
-
- ViewBag.Editor = editor.MvcGetString();
-
- return editor;
- }
-
-
-
- [ValidateInput(false)]
- public ActionResult EditorAjaxHandler()
- {
- PrepairEditor(delegate(Editor editor)
- {
-
- });
- return new EmptyResult();
- }
Regards,
Ken