我有以下网格。
selectionFieldName: "selectedRow", ajaxUpdateContainerId: "gridContent");
grid.Pager(WebGridPagerModes.NextPrevious);}
<div id="gridContent">
@grid.GetHtml(tableStyle: "webGrid",
headerStyle: "header",
alternatingRowStyle: "alt",
selectedRowStyle: "select",
columns: grid.Columns(
grid.Column("TaskID", "TaskID"),
grid.Column("TaskDesc", " Task Desc", format: @Html.Raw(task.TaskDesc)),
grid.Column("TaskTitle", "Task Title", style: "description")
))
这一行:
grid.Column("TaskDesc", " Task Desc", format: @Html.Raw(task.TaskDesc)),
给了我一个错误。有没有办法在webgird中使用@html.Raw
帮助器而不会抛出错误?
答案 0 :(得分:0)
你应该可以这样做:
grid.Column("TaskDesc", " Task Desc", format: (item) => Html.Raw(item.TaskDesc)),