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?
@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?