I just do not get why the output does not show correctly
Here is my view code
@model IEnumerable<TheSite.Post>
@{
ViewBag.Title = "Index";
Layout = null;
}
document.write('<table>
@foreach (var p in Model)
{
<tr>
<td>
<a href="@p.Url">@p.Title</a>
</td>
</tr>
}
</table>');
Here is the output:
document.write('<table>
<tr>
<td>
<a href="http://www.test.com">test</a>
</td>
</tr>
</table>');
Here is the output I need:
document.write('<table><tr><td><a href="http://www.test.com">test</a></td></tr></table>');
I tried using the stringbuilder but the output was escaped.
Build it with the
StringBuilderand use:Html.Raw on MSDN