【问题标题】:How to use ActionLink in MVC WebGrid?如何在 MVC WebGrid 中使用 ActionLink?
【发布时间】:2013-09-24 14:03:32
【问题描述】:

我在我的 MVC Demo 应用程序中使用 WebGird,我正在尝试在 WebGrid 中使用 ActionLink,我该如何使用它?

查看:-

@model IEnumerable<RotationManager.Models.tableCustomer_M>
@{
    WebGrid listGrid = new WebGrid(Model);
}

 @listGrid.GetHtml(tableStyle: "table", footerStyle: "foot",
    columns: new[]{
     listGrid.Column("Customer_Id",format: (item) => Html.ActionLink(item.Customer_Id, "Edit",new {@id=item.Customer_Id},null))
    })

上面的代码行不通。

请帮帮我!

任何帮助将不胜感激!

【问题讨论】:

标签: asp.net-mvc-4 razor webgrid


【解决方案1】:
@listGrid.GetHtml(tableStyle: "table", footerStyle: "foot",
    columns: new[]{
     listGrid.Column(header: "Customer_Id", format: item => new HtmlString(
                     Html.ActionLink((string)item.Customer_Id.ToString(), 
                    "Edit", new { @id = item.Customer_Id} ).ToString()))
    })

【讨论】:

    猜你喜欢
    • 2012-08-17
    • 2015-03-23
    • 2018-06-06
    • 1970-01-01
    • 1970-01-01
    • 2012-09-30
    • 1970-01-01
    • 1970-01-01
    • 2012-08-07
    相关资源
    最近更新 更多