Displaying HTML String from Model in MVC Razor View

前端 未结 4 431
星月不相逢
星月不相逢 2021-01-12 01:43

I have a Model filed that returns an HTML string with line break BR tag, but How do I display that HTML on the browser ? The problem ins instead putting the line break, the

4条回答
  •  时光说笑
    2021-01-12 02:21

    In MVC4

    Instead of using @Html.Raw(modelItem => item.Speaking)

    You can use @Html.Raw(@Model.Speaking.ToString())

    It works for me and I hope this help someone else too

提交回复
热议问题