Designs | Resume | KamranAyub.com | email: ayubx003 (@umn.edu)

« Lightweight Rich-Text Editor [jQuery] | Main | Getting What I Paid For [Is it so much to ask?] »

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.

Filed Under: Coding Tips and Tricks

Comments

This data pager you mentioned above is great. Thanks also for attaching the code and tips and tracks.

You have to create a custom paging control to make everything work smoothly.

Post a comment

About the Author

Kamran
Divide by Zero is Kamran Ayub's personal blog. Kamran owns and operates Intrepid Studios, a web design and development firm based in Minneapolis. Despite the above picture, Kamran is usually an intelligent person. Please forgive him.

View Kamran Ayub's profile on LinkedIn

Add to Technorati Favorites