ASP.NET Database Paging Sample Code

January 27, 2004

[From ASP 101]

Here's an ASP.NET version of our classic "Database Paging" script. While paging through query results is much easier in ASP.NET then it was in classic ASP, it never hurts to have some sample code to take a look at...

There are two types of paging supported by ASP.NET's DataGrid control: default paging and custom paging. This sample illustrates default paging. Of the two types, default paging is much simpler, but it's also less efficient. The reason for this is that the paging is performed on the web server and not at the DB. This results in every record in the table being retrieved for each request even though only the records on the current page are shown. For small tables, the difference isn't all that noticable, but as your table size increases, the performance will decrease and the resources required will increase.

The article continues at http://www.asp101.com/samples/db_paging_aspx.asp