This is a migrated thread and some comments may be shown as answers.

Editor show html tags after postback (use Encode(true) and decode by HttpUtility.HtmlDecode in server)

1 Answer 1303 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Appvl
Top achievements
Rank 1
Appvl asked on 30 Aug 2013, 04:58 PM
I have a view, use editor:
@using (Html.BeginForm("Index", "Home"))
{
    @Html.Kendo().EditorFor(m=> m.MyHtml).Encode(true)

    <input type="submit" value="Save" />
}

and in controller:
public ActionResult Index()
        {           
            var viewModel = new ViewModel { MyHtml = "test <strong>html</strong>" };
            return View(viewModel);
        }

        [HttpPost]
        public ActionResult Index(ViewModel model)
        {
            model.MyHtml = Server.HtmlDecode(model.MyHtml);
            //model.MyHtml == "test <strong>html</strong>" at here
            return View(model);
        }

the view in Get request is correct. Without any editing, click Save and after Post request, the view is showed html tags.

Does it is bug or not? How to show correct html after postback without Encode(fase) + [AllowHtml] in model?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Sep 2013, 02:33 PM
Hello,

Please refer to the following forum thread, which discusses the same topic:

http://www.kendoui.com/forums/kendo-ui-web/editor/problems-with-editor-showing-html-tags.aspx

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Editor
Asked by
Appvl
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or