在我的主页,我的代码@{Html.RenderPartial("_Partial1.cshtml");}
,并在我的部分,我有一个HTML字符串:如何在ASP.NET MVC中呈现HTML字符串?
@{
// The string is actually dynamic, not static. This is here for simplicity
string abc="<div class=\"error\">abc</div>";
}
@abc
我想一些CSS错误样式输出abc
,但事实上,我<div class="error">abc</div>
- 当然,那里没有风格。我如何将它解释为HTML源代码而不是字符串?
http://stackoverflow.com/questions/4281424/asp-net-mvc-razor-output-html-string-non-escaped – adt 2013-03-21 13:26:13
'