Working with Data in ASP.NET 2.0 - Efficiently Paging Through Large Amounts of Data

Working with Data in ASP.NET 2.0 - Efficiently Paging Through Large Amounts of DataAs we discussed in the preceding tutorial, paging can be implemented in one of two ways:
- Default Paging – can be implemented by simply checking the Enable Paging option in the data Web control’’s smart tag? however, whenever viewing a page of data, the ObjectDataSource retrieves all of the records, even though only a subset of them are displayed in the page
- Custom Paging – improves the performance of default paging by retrieving only those records from the database that need to be displayed for the particular page of data requested by the user? however, custom paging involves a bit more effort to implement than default paging

Due to the ease of implementation – just check a checkbox and you”re done! – default paging is an attractive option. Its na?ve approach in retrieving all of the records, though, makes it an implausible choice when paging through sufficiently large amounts of data or for sites with many concurrent users. In such circumstances, we must turn to custom paging in order to provide a responsive system.

The challenge of custom paging is being able to write a query that returns the precise set of records needed for a particular page of data. Fortunately, Microsoft SQL Server 2005 provides a new keyword for ranking results, which enables us to write a query that can efficiently retrieve the proper subset of records. In this tutorial we”ll see how to use this new SQL Server 2005 keyword to implement custom paging in a GridView control. While the user interface for custom paging is identical to that for default paging, stepping from one page to the next using custom paging can be several orders of magnitude faster than default paging.

Note: The exact performance gain exhibited by custom paging depends on the total number of records being paged through and the load being placed on the database server. At the end of this tutorial we”ll look at some rough metrics that showcase the benefits in performance obtained through custom paging.

Website: static.asp.net | Filesize: 1058kb
No of Page(s): 25
Click here to download Working with Data in ASP.NET 2.0 - Efficiently Paging Through Large Amounts of Data.

Related Copyrighted Books

Related Tutorial

Tags: , , , , ,

Comments

Leave a Reply