My models:
public class htmlDump {
public string html { get; set; }
}
public string getSquares() {
var sq = (from s in n.squares
where s.active == true
orderby s.date_created descending
select s.html).First();
return sq;
}
My controller:
public ActionResult index() {
intranetGS.htmlDump sq = new intranetGS.htmlDump {
html = g.getSquares()
};
return View(sq);
}
My View:
@Html.DisplayFor(model => model.html)
All I want is for the html being passed to the view to be rendered as html and not as text. Surely there's something different I can use in the view (instead of .DisplayFor) that will work. Any suggestions?
Thanks very much!
@Html.Raw(Model.html)
NOTE: if this data can be input by the user - make sure it's sanitized.
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