CheckBox values in Html.Grid
I have a model with a List of invoices. I am displaying this list of invoices in a grid. I would like to have a column of check boxes in the grid so I can perform some additional logic. How would I go about reading the values of these check boxes when I post? Basically what I need is to have a Html.CheckBoxFor
in a column for each of the items in the list. I don't think that's possible but is there a way to have something similar?
Here's my grid:
<% 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("In开发者_StackOverflowvoice 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();
%>
After review, I'm taking a guess that you are using the mvccontrib-grid? If so take a look at this answer from DD: Mvc Contrib grid with checkbox
精彩评论