ASP.NET MVC Grid Display solutions [closed]
I realize there are several solutions to this problem. I am looking for advice on an elegant way to solve a few issues..
I am using Entity Framework for my model.
I need to display tables of data with paging and sorting as minimum functionality.
Before switching to MVC, in WebForms, I was a big fan of the jQuery Datatables plugin..and I used this, with success, alongside a custom parser class to handle paging sorting and filtering. I have now run into a problem using this method with EF
My question is, is there a preferred method to handle Grids in MVC with paging and sorting functionality...
So far I am aware of the following possible solutions:
jQuery Datatables plugin with some more custom parser work(I would need some help getting started in the right direction with this)
jqGrid..I understand that there is an open source version as well as a paid version which seems to include a server side solution for MVC
MVCContrib Grid...I dont know much about this and I am not even sure if this is still an accepted solution.
Telerik MVC Controls (as suggested in answers below)...seems to be the most popular choice so far...
My main concern is reusability. I would like a solution flexible enough to handle any model/viewmodel I pass in with a minimum amount of custom code. I often run into a situation where I need to display only a few properties of a particular model or need to display properties from a related class(I.E Product.ProductName, Product.ProductCategory.CategoryName)
Any help or advice would be much appreciated.
EDIT
I have decided to try out the Telerik MVC Grid for now. I have high hopes for the jQuery-UI Grid that is currently in development. I hope there will be support for ASP.NET MVC considering MS is a sponsor. What I gather from the jQuery site is that their Grid control will be inspired by all the best aspects of the most popular grid controls, including the ones mentioned above. Fingers crossed...
I would take a good look at the Telerik MVC open source components.
Telerik demos
If you bind your grids to IQueryable you also get paging, sorting, filtering and grouping straight out of the box. Their editor component is pretty cool as well.
Some help with DataTables:
http://www.codeproject.com/KB/aspnet/JQuery-DataTables-MVC.aspx
http://www.codeproject.com/KB/aspnet/MVC-CRUD-DataTable.aspx
The Telerik MVC components seem pretty decent - they're based off jQuery and are fairly lightweight in the html they generate. The MVC components are free and open source - you can even get them off nuget. They do have a support license that costs money and most of their other stuff isn't free, but the MVC ones are.
精彩评论