PermaLink ASP.Net DataPager Efficient w/ ObjectDataSource12/15/2010
If you use a DataPager w/ a regular DataSource control so that you can page .Net 4.0's ListView, you'll find that it loads the entire dataset each time it pages.  However, if you create a data access class that you can connect to an ObjectDataSource control that you then connect the DataPager to, the DataPager will use the ObjectDataSource's startindex/maxrows to read the data somewhat efficiently.  Setting it up is a bit convoluted, but it's covered in this blog post relatively well: http://samsalisbury.net/articles/objectdatasource-listview-paging-minimal-example/
However, there is still a weakness in the ObjectDataSource.  When your data layer is called, there is no access to the web page fields, so you have to use the ObjectDataSource's Selecting event to load them and this can get tedious if you have a lot of fields.  The ObjectDataSource also seems to call your TotalRowCount function every time it pages instead of storing that value in viewstate or a cookie.
Comments :v
No comments.
Start Pages
RSS News Feed RSS Comments Feed CoComment Integrated
The BlogRoll
Calendar
November 2024
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Search
Contact Me
About Ken
Full-stack developer (consultant) working with .Net, Java, Android, Javascript (jQuery, Meteor.js, AngularJS), Lotus Domino