Alex Rivera | Logout

How use Kendo UI Editor in asp.net mvc3 with razor?

Asked 2012-06-21T06:30:00.453
8

I'm using editor from Kendo UI, so I have big problem.

I don't know how display items which are returned by editor.

Editor convert something like:

<img src="someurl" />

to:

lt;p&gt;&lt;img src=&quot;someurl&quot;/&gt;&lt;/p&gt;

and I keep converted string in database, and try display it with:

@Html.Raw(item.description)

where description is string returned by kendo.

So I have no idea how display it correctly in my View

Any help would be appreciated.

Edit
Report

1 Answer

9

I found this solution for MVC: in View

<div class="editor-field">
    @(Html.Kendo().EditorFor(model => model.HtmlField).Encode(false))
    @Html.ValidationMessageFor(model => model.HtmlField)
</div>

in model:

   [DataType(DataType.Html)]
   [AllowHtml]
   public string HtmlField{ get; set; }

That was enough

answered 2013-05-04T18:37:59.173

Your Answer