ASP.NET MVC HtmlDecode WebGrid列

时间:2013-01-23 14:13:28

标签: asp.net-mvc webgrid

我想在WebGrid中使用System.Web.HttpUtility.HtmlDecode但它不能正常工作 我的代码是:

grid.GetHtml(tableStyle: "webGrid",
             htmlAttributes: new { id = "DataTable" },
             headerStyle: "header",
             alternatingRowStyle: "alt",
             columns: grid.Columns(
                 grid.Column("ArtId"),
                 grid.Column(columnName: "ArtDescription",
                                         format: item => System.Web.HttpUtility.HtmlDecode(item.ArtDescription))
             )
 ) 

1 个答案:

答案 0 :(得分:1)

您应该使用Html.Raw

format: item => Html.Raw(item.ArtDescription)