Wednesday, December 2, 2015

MVC: Display string as HTML from database to view

Following is the way to display html in view:

For aspx:
<%= System.Web.HttpUtility.HtmlDecode(@Model.Html) %>

For Razor:

@Html.Raw(Server.HtmlDecode(@Model.Html))

No comments:

Post a Comment