使用Bootstrap和WebGrid列?

时间:2016-04-27 15:57:47

标签: asp.net-mvc twitter-bootstrap webgrid

我一直在寻找示例,但似乎无法找到如何在网格列中使用Bootstrap来创建按钮。以下工作,但我想显示一个编辑按钮,而不只是文本。

@grid.GetHtml(tableStyle: "webgrid-table",
    headerStyle: "webgrid-header",
    rowStyle: "webgrid-row-style",
    alternatingRowStyle: "webgrid-alternating-row",
    selectedRowStyle: "webgrid-selected-row",
    footerStyle: "webgrid-footer",

    columns: grid.Columns(
        grid.Column(columnName: "CustomerName", header: "Customer Name"),
        grid.Column(columnName: "Subject", header: "Subject"),
        grid.Column(columnName: "CallDate", header: "Call Date"),
        grid.Column(columnName: "Status", header: "Status"),
        grid.Column(header: "Edit", format: (item) =>
        {
            var link = Html.ActionLink("Edit", "Edit", new { id = item.Id });
            return link;
        }),

任何人都知道我将一个示例转换为使用Bootstrap按钮来编辑?

1 个答案:

答案 0 :(得分:2)

尝试为该特定列添加style参数,如下所示:

grid.Column(header: "Edit", format: (item) =>
{
    var link = Html.ActionLink("Edit", "Edit", new { id = item.Id });
    return link;
}, style: "btn btn-default")