因此,我從Rally Web服務檢索數據,並且描述字段包含html標記。如何處理字符串中的Html標記 - 當顯示在MVC頁面
我的MVC網頁看起來是這樣的:
<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>
標籤顯示爲文本 如在HTML:
<DIV>As a Marketing Analytics And Data Manager</DIV>
我已經試過編碼和解碼,但那些都正在生產所需響應。編碼它會將<
轉換爲<
類型文本。
<td>@HttpUtility.HtmlEncode(story["Description"])</td>
希望它只是一些簡單的我錯過了!
除非我應該剝離標籤?
謝謝 - 這就是我需要的:) – Jen