buntykawale
buntykawale

Reputation: 191

What is the easy way of implementing Paging in ASP.NET MVC?

Being new to ASP.NET MVC, I would like to know the easy method of paging. The data is IQueryable type.

Upvotes: 0

Views: 265

Answers (2)

Craig Stuntz
Craig Stuntz

Reputation: 126587

I've been using this PagedList type, originally developed by Rob Conery, and enhanced by Troy Goode. I've even written extension methods which make it work with jqGrid. For sheer ease of use, I don't think you're going to beat it.

Upvotes: 4

Mehrdad Afshari
Mehrdad Afshari

Reputation: 422252

var dataPage = data.Skip(pageNumber * pageSize - pageSize).Take(pageSize);

To learn the basic tricks of ASP.NET MVC, I suggest reading the free Professional ASP.NET MVC 1.0 Book Chapter 1 by Scott Guthrie

Upvotes: 2

Related Questions