Parminder
Parminder

Reputation: 3158

Html.Raw is not working asp.net mvc

I have some html stored in a table. here is some sample data

<p><span style="font-size: small; color: #ff0000;"><span style="font-size: small;"> <span style="font-size: large; color: #000000;">ਮਾਂ</span><br />  <br />ਚਾਵਾਂ ਸਧਰਾਂ ਦੇ ਨਾਲ ਮਾਏ ਜੋ ਤੂੰ ਬੂਟਾ ਲਾਇਆ,<br />ਦੇ ਮਮਤਾ ਦਾ ਪਾਣੀ ਅੱਜ ਓਹ ਭਰ ਜੋਬਨ ਤੇ ਆਇਆ,<br />

I am trying to display on page, I am using asp.net mvc razor view and using

@Html.Raw(blog.Body)

but its not working. can someone help, what is the reason.

Thanks

Parminder

Upvotes: 24

Views: 31934

Answers (1)

Mohammed Swillam
Mohammed Swillam

Reputation: 9242

kindly try this:

@Html.Raw(HttpUtility.HtmlDecode(blog.Body));

and let me know if it worked.

Upvotes: 57

Related Questions