Efficient Data Paging with the ASP.NET 2.0 DataList Control and ObjectDataSource
page 2 of 5
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 47945/ 71

How To Run and Use the Sample

To setup the sample, follow the below steps:

 

1) Have VS 2005 or Visual Web Developer and SQL Express installed.  Visual Web Developer and SQL Express are both free downloads and provide everything you need to build, debug and run the application.  You can download them from here.

2) Download this .zip file containing the sample.  Expand it into any directory you want.

3) Using Visual Web Developer or VS 2005, choose File->Open Web-site and point to the root directory of the sample sub-directory (the one with the files in it).

4) Select the “Products.aspx” file and hit run.

This will bring up a page like the screenshot above that lists products and allows you to page back and forth throughout a product category listing (note that the next/previous buttons will auto-hide if you are at the beginning or end of the listing).  Click on the left-hand side of the page to switch category listings.

To add a new product category, run the “AddData.aspx” page:

Figure 2

When you add a new product category, you can specify the number of products to add to it.  You can add dozens, hundreds, thousands or tens of thousands of products (the AddData.aspx page names the products sequentially for you automatically so you can simulate different sized loads).

Because the data paging implementation in the sample uses an intelligent paging algorithm that only pulls the needed page rows to the web-server (by default only 10 rows per web request), your server won’t start to run into performance issues even if you have a category or result with tens of thousands of product results.


View Entire Article

User Comments

Title: That great but,   
Name: Quoc Thinh
Date: 2007-08-17 11:42:53 PM
Comment:
There are two thing, first SQL 2000 don't have ROW_NUMBER, and the second if the results has too many pages, and the pager should be, for example 10 page per view then when click Next, it show next 10 pager. So is there any solution for it, and even if you could this should use AJAX.
Thank very much
Title: That great but,   
Name: Quoc Thinh
Date: 2007-07-01 11:06:28 AM
Comment:
There are two thing, first SQL 2000 don't have ROW_NUMBER, and the second if the results has too many pages, and the pager should be, for example 10 page per view then when click Next, it show next 10 pager. So is there any solution for it, and even if you could this should use AJAX.
Thank very much
Title: Use the New keyword to create the instance.   
Name: Gary
Date: 2007-05-05 7:58:24 PM
Comment:
Great article Scott, but line 15 in Products.aspx.cs throws the error: "Use the New keyword to create an object instance."

I'm trying to work it out but I'm pretty new to C#.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2017 ASPAlliance.com  |  Page Processed at 2017-12-17 4:17:16 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search