Razor - How to display html content in a div tag?

asp.net, asp.net-mvc, asp.net-mvc-3, razor

Solution

You should use:

@foreach (var item in Model)
{
    <div>@Html.Raw(item.Description)</div>
}

Problem

Here is my razor code: ``` <fieldset> <legend>Headline News</legend> @foreach (var item in Model) { <div>@Html.DisplayFor(modelitem => item.Description)</div> } </fieldset> ``` The value for `item.Description` is HTML: ``` <table border="0" cellpadding="2" cellspacing="7" style="vertical-align:top;"><tr><td width="80" align="center" valign="top"> {{ table info }} </table> ``` I actually want to display the HTML content, but it shows up as HTML tags. Thanks in advance!

Original source