Html.Grid中的CheckBox值

时间:2011-08-30 15:10:56

标签: c# asp.net-mvc asp.net-mvc-2 html-helper

我有一张带发票清单的模型。我在网格中显示这张发票清单。我想在网格中有一列复选框,以便我可以执行一些额外的逻辑。我发布时如何阅读这些复选框的值?基本上我需要的是在列的每个项目的列中都有一个Html.CheckBoxFor。我不认为这是可能的,但有没有办法有类似的东西?

这是我的网格:

<% Html.Grid(Model.Invoices)     
       .Attributes(@id => "tblInvoiceSearchResults", @class => "tablesorter", style => "width:100%")
       .Empty("No invoice exist with that criteria")
       .Columns(
        col =>
            {
              col.For(c => c.InvoiceNumber).Named("Invoice Number");
              col.For(c => c.InvoicePurchaseOrderNumber).Named("PurchaseOrder");
              col.For(c => c.InvoiceStatus).Named("Invoice Status");
              col.For(c => c.OpenAmount.ToMoneyDisplay()).Visible((bool)ViewData["canSeePricing"])
                    .Named("Open Amt").Attributes(align=>"right");
              col.For(c => c.OriginalAmount.ToMoneyDisplay()).Visible((bool)ViewData["canSeePricing"])
                    .Named("Original Amt")
                    .Attributes(align => "right"); 
              col.For(c => c.InvoiceDate).Named("Invoice Date");
        }).Render();
 %>

1 个答案:

答案 0 :(得分:1)

经过审核,我猜你正在使用mvccontrib-grid?如果是这样,请看一下DD的答案:Mvc Contrib grid with checkbox