Effective Data Paging Using SQL Server 2005 and Microsoft's Enterprise Library

June 10, 2005

[From ASP101]

Displaying records from a table in a tabular way became very easy in ASP.NET. All you have to do is set a DataSource property on a DataGrid component to a DataSet containing records (or any object implementing the IList or IListSource interface). If the number of records in your data source is greater than the size of your screen, you can page through your records using the paging mechanism built in to the DataGrid. In most cases, this is a convenient and easy solution, but as your website becomes mature and the database accumulates more data you will probably notice a considerable amount of delay while paging the grid. Don't worry, your web server is still fine and so is your database server. The problem relies on the fact that your data grid pulls out all the records in your data source and then divides it into pages. In essence, you cache all the records in your table every time the page is loaded regardless of what you see on the screen. Try paging through one million records and you will probably need to wait about five minutes between page refreshes. That is assuming your web server can actually cache the data and will not run out of memory.

The article continues at http://www.asp101.com/articles/gal/effectivepaging/default.asp