I have been trying to implement paging for quite a while now and I found this tutorial for paging with MVC: ASP.NET MVC Paging Done Perfectly
Now, in this solution,
The linked tutorial looks odd, because it uses a List
. This will indeed bring all the clients into memory and then page through that. Instead, you should look for methods that use IQueryable
, specifically Skip
and Take
, so paging should look like
IQueryable clients = repo.GetClients(); // lazy load - does nothing
List paged = clients.Skip(20).Take(10).ToList(); // execute final SQL
Depending on what mappers you use, you will find similar methods in EF, NHibernate, Linq-to-SQL etc