asp.net-mvc 使用 MVC 的 ASP.Net Gridview 控件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4101208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ASP.Net Gridview control with MVC
提问by shraddha
I've a requirement to use ASP.Net Grdview control in ASP.Net MVC. Now I need to handle form submit action.I'm using Objectdatasource for filling my grid. Now when I submit, I need to have current state of my grid data which includes checkboxes checked state.
我需要在 ASP.Net MVC 中使用 ASP.Net Grdview 控件。现在我需要处理表单提交操作。我正在使用 Objectdatasource 来填充我的网格。现在,当我提交时,我需要拥有网格数据的当前状态,其中包括复选框选中状态。
回答by Samuel Neff
The old ASP.NET controls are made to work with traditional web forms and processing through postback. ASP.NET MVC doesn't use postbacks so they won't work together well. You can use the controls for displaying data well enough, but getting processing on the server will be prohibitively complicated.
旧的 ASP.NET 控件用于处理传统的 Web 表单并通过回发进行处理。ASP.NET MVC 不使用回发,因此它们不能很好地协同工作。您可以使用控件来很好地显示数据,但是在服务器上进行处理将非常复杂。
You'll be much better off using a grid control designed specifically for ASP.NET MVC. Here's a good question with links to several:
使用专为 ASP.NET MVC 设计的网格控件会更好。这是一个很好的问题,有几个链接: