Better DataPager in .NET 3.5 [Efficient] | Posted at 7:39 PM
I am working on a custom blog implementation for Intrepid Studios and I am using a ListView to display posts on the front page. It's just a very nice control…
Anyway, paging for a ListView is done by adding a DataPager control to the page and customizing its behavior.
I was interested in seeing how efficient it was, expecting it to properly utilize my LinqDataSource's ability to grab only the actual number of rows needed from my SQL database.
The articles I read on 4GuysFromRolla and other sites mentioned that it does not, but they were referencing an SqlDataSource.
It turns out, the DataPager does use efficient paging with a LinqDataSource and you do not need to put it within a <form runat="server"> tag to use (just use the QueryStringField property!).
How come? From what I understand, the LinqDataSource uses automatic paging to only get a certain number of rows. That's why it is the only DataSource control with an "AutoPage" property.
I am exceedingly happy with this.