Hi I have DataTable that I am exposing as a JSON in a web API but I would like to do a custom paging in my result.
someID | Name | Other|
234 | John | Work
534 | Luis | Yes
834 | Raul | No
....
So the DataTable is created dynamically on codebehind and I would like to return only the 20 element from an specific position. I read about DataTable.Select but I dint see any example of it.
Any idea on how can I do a paging to a datatable using and start point like "someID" this number are unique.
sinedyip
Member
308 Points
154 Posts
Paging in a DataTable
Dec 26, 2012 08:51 PM|LINK
Hi I have DataTable that I am exposing as a JSON in a web API but I would like to do a custom paging in my result.
someID | Name | Other|
234 | John | Work
534 | Luis | Yes
834 | Raul | No
....
So the DataTable is created dynamically on codebehind and I would like to return only the 20 element from an specific position. I read about DataTable.Select but I dint see any example of it.
Any idea on how can I do a paging to a datatable using and start point like "someID" this number are unique.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Paging in a DataTable
Dec 27, 2012 08:24 AM|LINK
Hi,
You can:
1) If you bind the DataSource directly to the GridView, you can just make your GridView's Paging = True.
2) If your GridView wanna Customized Paging, you can just refer this sample:
http://www.codeproject.com/Articles/16238/GridView-Custom-Paging
sinedyip
Member
308 Points
154 Posts
Re: Paging in a DataTable
Dec 27, 2012 10:17 AM|LINK
My final goal is expose that data in a web API so I am not using a GridView.
The data is a JSON