Html.Grid 中的复选框值
我有一个带有发票列表的模型。我正在网格中显示此发票列表。我希望在网格中有一列复选框,以便我可以执行一些附加逻辑。当我发帖时,我将如何读取这些复选框的值?基本上我需要的是在列表中的每个项目的列中都有一个 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();
%>
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("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();
%>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过审查,我猜测您正在使用 mvccontrib-grid?如果是这样,请查看 DD 的答案:带有复选框的 Mvc Contrib 网格
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