I am using a CKEditor on my MVC project. I'm saving HTML into the DB. WHen I read it and display it on screen, what I get is
<p> <a href="http://www.cnh.com">www.cnh.com</a></p> <p> &nbsp;</p>
I use Html.DisplayFor.
<td>
@Html.DisplayFor(modelItem => item.SampleCollectionInstructions)
</td>
How can I make it display the links properly and one per line??
Use Raw method
to return markup without html encoded
Ex;
@Html.Raw("<div>Some text</div>")
If anyone else is confused about doing this in loops, like I was:
You can just omit both DisplayFor and modelItem =>, so:
@Html.Raw(item.SampleCollectionInstructions)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With