使用MVCContrib网格编辑 [英] Use MVCContrib grid for editing
问题描述
我刚开始使用在测试项目中的MVCContrib网格。我有一个很难找到如何使用它进行编辑/更新/删除。
I just started using the MVCContrib grid in a test project. I'm having a difficult time finding information on how to use it for edit/update/delete.
任何人都可以点我就如何把一行到编辑模式的信息,或者如果没有为电网这样的事情,讨论编辑列表数据的最佳实践MVC。
Can anyone point me to information on how to put a row into edit mode, or if there isn't such a thing for that grid, discuss a best practice for editing list data in MVC.
推荐答案
这看起来好像MVCContrib是一个简单的方法来从模型对象的集合构建HTML表格。它不会出现,如果有把一行到编辑/更新任何能力/删除模式类似的WebForms GridView的。
It appears as if MVCContrib is a simple way to construct the HTML Table from a collection of model objects. It doesn't appear as if has any ability to put a row into edit/update/delete "mode" similar to the WebForms GridView.
不过,它看起来像,但是你想你可以处理这个功能。如果你想去的编辑模式一个单独的页面,只是把与该行的ID列中的链接。直接取自以下内容:http://www.jeremyskinner.co.uk/2009/03/01/mvccontrib-grid-part-5-the-action-syntax/
However, it does look like you can handle that functionality however you want to. If you want to go to a separate page for edit mode, just put a link in one of the columns with that row's id. The following is taken directly from: http://www.jeremyskinner.co.uk/2009/03/01/mvccontrib-grid-part-5-the-action-syntax/
<% Html.Grid(Model).Columns(column => {
column.For(x => x.Id).Named("Person ID");
column.For(x => x.Name);
column.For(x => x.Gender);
column.For(x => x.DateOfBirth);
column.For("View Person").Named("").Action(p => { %>
<td style="font-weight:bold">
<%= Html.ActionLink("View Person", "Show", new { id = p.Id })%>
</td>
<% });
}).RowStart((p,row) => {
if (row.IsAlternate) { %>
<tr style="background-color:#CCDDCC">
<% } else { %>
<tr>
<% }
}).Render(); %>
这看起来他们是想将用户引导到一个浏览个人页面:&LT;%= Html.ActionLink(观人,秀,新{ID = p.Id })%方式&gt;
祝你好运,快乐编码。
这篇关于使用MVCContrib网格编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!