Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
content returned from editor is completely encoded
posted

(MVC 3 app)

Whenever I post a form with an editor on it, the content stored in my viewmodel is encoded.

The start of my test is with <p>Test</p> stored in the database.

When the content is edited for the first time, it is displayed OK.

When I click on my save button, and the data is posted. In the viewmodel in my controller I already see : %3Cp%3ETest%3C/p%3E

This value is stored in the database and the next time I want to edit the record, this text is shown as stored : %3Cp%3ETest%3C/p%3E

 

I have to say, to get this editor working in my environment I spent hours... It is an existing application, and all data editing is done in a modal dialog by means of a partial view.
First of all, the MVC helper did not fill in the content at all. And then when doing it with setContent, I always got an error on .contentWindow

I made it work with the following :

$.ig.loader(function () {
var heditor = $("#igTemplateHTML");
var frame = $("iframe", heditor).get(0);
var editorContent = "@Model.TemplateHTML";
$(heditor).igHtmlEditor(
"setContent", editorContent, "html");
});


Part of the code where the editor is used.


<
script src="@Url.Content("scripts/infragistics/infragistics.loader.js")"></script>

@Html.Infragistics().Loader().ScriptPath(Url.Content("scripts/infragistics")).CssPath(Url.Content("Content/infragistics")).Render()

@using (Ajax.BeginForm(ajaxOptions, "editFormTemplate"))
{
@Html.ValidationSummary()
<div>
@Html.HiddenFor(model => model.Id)
@Html.EditorLineFor(model => model.TemplateNL, true)
@Html.Infragistics().HtmlEditorFor(model => model.TemplateHTML).ID("igTemplateHTML").Width("800px").Height("500px").Render()
</div>
}