Asp.net mvc 4 如何处理字符串中的Html标记-在MVC页面中显示时
因此,我正在从Rally web服务检索数据,并且描述字段包含html标记 我的MVC页面如下所示:Asp.net mvc 4 如何处理字符串中的Html标记-在MVC页面中显示时,asp.net-mvc-4,rally,Asp.net Mvc 4,Rally,因此,我正在从Rally web服务检索数据,并且描述字段包含html标记 我的MVC页面如下所示: <table width="100%" id="stories"> <tr> <td>ID</td> <td>Name</td> <td>Description</td> <td>
<table width="100%" id="stories">
<tr>
<td>ID</td>
<td>Name</td>
<td>Description</td>
<td>TaskEstimateTotal</td>
</tr>
@foreach (var story in Model.UserStories)
{
<tr>
<td>@story["FormattedID"]</td>
<td>@story["Name"]</td>
<td>@story["Description"]</td>
<td>@story["TaskEstimateTotal"]</td>
</tr>
}
</table>
希望我错过了一些简单的东西
除非我要剥掉标签?您是否尝试过:
<td>@Html.Raw(story["Description"])</td>
@Html.Raw(故事[“描述”])
MSDN:您是否尝试过:
<td>@Html.Raw(story["Description"])</td>
@Html.Raw(故事[“描述”])
MSDN:您可以执行以下操作:
<td>@Html.Raw(story["Description"])</td>
@Html.Raw(故事[“描述”])
Razor html默认编码字符串。您可以执行以下操作:
<td>@Html.Raw(story["Description"])</td>
@Html.Raw(故事[“描述”])
Razor html默认情况下对字符串进行编码。谢谢-这是我需要的:)谢谢-这是我需要的:)谢谢-这是我需要的(其他人必须在您之前发布,所以我已根据订单接受):)谢谢-这是我需要的(其他人必须在您之前发布,所以我已根据订单接受):)