我正在尝试使用webgrid以HTML格式显示显示内容。我该怎么做呢?
屏幕截图:
我的网格:
@grid.GetHtml(htmlAttributes: new { id = "grid" }, fillEmptyRows: false, tableStyle: "table", footerStyle: "foot", mode: WebGridPagerModes.All, firstText: "<< First", previousText: "< Prev", nextText: "Next >", lastText: "Last >>", columns: new[] {
grid.Column("PublishedContent",
header: "Content"
),
grid.Column("Layout", header: "Layout"),
grid.Column("_Status", header: "Status"),
grid.Column("",
header: "Actions", style: "_action",
format: @<text>
@Html.ActionLink("Edit", "Published", new { id = item.id }, new { @class = "editDialog"/*, data_dialog_id = "edit-Dialog"*/ })
|
@Html.ActionLink("Delete", "_DeletePublished", new { id = item.id }, new { @class = "confirmDialog" })
</text>
)
})
答案 0 :(得分:0)
您需要在Html.Raw()
参数中使用format
来阻止HtmlEncoding发生:
grid.Column("PublishedContent", header: "Content", format: @<text>@Html.Raw(item.PublishedContent)</text>)