Aug 28 2008

Paging LINQ results in a GridView, make sure it's a List


Thanks to Mark Coffman: http://markcoffman.com/2008/05/27/linq-results-for-paging-in-a-datagrid.aspx

When using binding a gridview to a LINQ result, make sure you return it to a List<T> (I’m assuming any IEnumerable<T> would work, but I really like the List<T>) to prevent yourself from getting

The datasource does not support server-side data paging.

Note that this is for easy paging.  If you want to do true data-paging with LINQ obviously you need to utilize the Skip() and Take() methods to get back just the data you want to show.

But I’m lazy… :)



Comments

12/14/2008 3:04:23 PM
busby seo test
Thanks for the nice tips about Paging LINQ results in a GridView, make sure it’s a List<T>
5/25/2009 12:59:13 AM
medications
I think that is very easy and does not take much time.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading