Paging & Sorting grids with ASP.Net MVC

nowadays MVC 3 now has a webGrid out of the box. I know this question is from a while ago, but I ended up on it when looking for something about webGrid. So I thought it should have an answer mentioning the new webGrid.

Here are a few good posts on how to use it:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=615

http://cnug.co.in/blogs/shijuv/archive/2010/10/08/using-the-webgrid-helper-in-asp-net-mvc-3-beta.aspx

http://www.nickharris.net/tag/webgrid/

It supports sorting, paging and also some Ajax stuff. It can do lot for you already, but you can also specify every separate column separately.

Update:
There are also many JavaScript libraries available that can do the table for you. I personally like to use DataTables. You can feed it an existing html table generated on the server or give it an endpoint where it can retrieve the data (all or just one page).

There are plenty more, just Google around.

Leave a Comment