Troy Goode


PagedList Strikes Back

There is an updated version of the PagedList<T> code available on GitHub.

A few months ago I posted about my changes to Rob Conery's PagedList class. Since writing that article many comments have been left about how to further improve the design, which I have since incorporated into a new, further improved PagedList class. For those who aren't familiar, the PagedList class allows scenarios such as the following:

So in the above scenario (an example MVC action), if you had a list of 30 products with IDs 1-30 and passed in a pageIndex of 2 you would pass the products with IDs 21-30 into your view. Best of all it uses IQueryable, so if you pass a LINQ expression or IQueryable result into ToPagedList(...) it will do the filtering on the database side! Take a look at the new improved PagedList on GitHub.

Changes Since Previous Version:

A big thanks to everyone who has thrown their two cents in to help improve this small but useful class!