background preloader

Paging

Facebook Twitter

MVC Paging/Sorting/Filtering using the MVCContrib Grid and Pager - Raj Kaimal. This post walks you through creating a UI for paging, sorting and filtering a list of data items. It makes use of the excellent MVCContrib Grid and Pager Html UI helpers. A sample project is attached at the bottom. Our UI will eventually look like this. The application will make use of the Northwind database. The top portion of the page has a filter area region. The filter region is enclosed in a form tag. The page has a pager region at the top and bottom of the product list. The product list has a link to display more details about a given product. A request with this UI will look similar to this : /Products?

Strongly Typed View Models The views are written to expect strongly typed objects. The following listing shows the ProductViewModel. Public class ProductViewModel [ScaffoldColumn(false)] public int? Public string ProductName { get; set; } [DisplayName("Unit Price")] public System.Nullable<decimal> UnitPrice { get; set; } [DisplayName("Category Name")] public int? Public int? /// <summary> Martijn Boland » NuGet package for MVC pager. It’s now possible to add the MVC pager to your own project with NuGet. Or from Visual Studio with ‘Manage NuGet Packages…’ and then search for ‘MvcPaging’. After installing, you can immediately use the Pager HtmlHelper in your views: et voilà! We also have include the IPagedList for your convenience: For more info, check out the original blogpost that started it or the github project page.

Enjoy! Ajax Paging with ASP.NET MVC. Src/MvcPaging.Demo/Controllers/PagingController.cs at mvc3-VS2010 · martijnboland/MvcPaging. Martijn Boland » Paging with ASP.NET MVC. Updated 2012-04-23: Version 2.0: Updated 2011-05-12: Added NuGet package: Updated 2011-03-22: Changed download link: See also Updated 2009-02-04: Upgraded source and demo to ASP.NET MVC RC1 Updated 2009-01-16: Upgraded source and demo to ASP.NET MVC Beta Updated 2008-09-09: Source and Demo now use ASP.NET MVC preview 5 On my latest gig, we used ASP.NET MVC and it was a very pleasant experience!

Of course, since ASP.NET MVC isn’t finished yet, it leaves something to desire. I’m in a hurry, take me to the download immediately IPagedList<T> First, there was the PagedList<T> that Scott Guthrie already used in one of the earliest MVC demo’s and that later appeared in improved incarnations from Rob Conery and Troy Goode. Html.Pager() results in this: MvcPager source code - PagerBuilder.cs. MvcPager.