小编Ter*_*t38的帖子

ASP.Net MVC SQL格式化HTML

我有一个SQL表,其中包含显示文本的HTML格式.

<strong>What Is EDI ?</strong><p>EDI is a method for communicating electronically with trading partners based upon standards.</p>

在我的MVC应用程序中,有一个index.cshtml页面如下:

<h2>Index</h2>
<table>
    <tr>
        <th> @Html.DisplayNameFor(model => model.Body)</th>
        <th></th>
    </tr>
@foreach (var item in Model) {
    <tr>
        <td>@Html.DisplayFor(modelItem => item.Body)</td>
    </tr>
}
</table>
Run Code Online (Sandbox Code Playgroud)

问题是文本显示为正常,没有HTML格式.任何人都可以帮助解决我遇到的问题吗?

c# asp.net asp.net-mvc razor asp.net-mvc-4

4
推荐指数
1
解决办法
206
查看次数

标签 统计

asp.net ×1

asp.net-mvc ×1

asp.net-mvc-4 ×1

c# ×1

razor ×1