I was run across issue to paging my list object in asp.net mvc where my object is simply load by LINQ-to-SQL.
Is it some kinds of will_paginates command?
in rails, i can do like
Users.paginate(:all, :page => 1, :page_size => 20)
I was run across issue to paging my list object in asp.net mvc where my object is simply load by LINQ-to-SQL.
Is it some kinds of will_paginates command?
in rails, i can do like
Users.paginate(:all, :page => 1, :page_size => 20)
In Linq this would be
Users.Skip(pageSize*page).Take(pageSize)
This would assume zero based counting.
Check out - http://pagedlist.codeplex.com/
Will create an extension method ToPagedList which can be used like so:
using PagedList;
var firstPage = list.ToPagedList(0, 20); // first page, page size = 20
Console.WriteLine("Is first page? {0}", firstPage.IsFirstPage); // true
Console.WriteLine("Is last page? {0}", firstPage.IsLastPage); // false
Console.WriteLine("First value on page? {0}", firstPage[0]); // 1
Console.WriteLine();
No there is not, but you should check out this blog post by Rob Conery that shows you a good way to implement it. http://blog.wekeroad.com/blog/aspnet-mvc-pagedlistt/