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.
We'll look at custom paging in a future sample, but for the time being here's a sample
of the ASP.NET DataGrid's default paging which works just fine for most applications.