The ASP.NET DataGrid exposes a wonderful capability: data
paging support. When paging is enabled in the DataGrid, a fixed number of
records are shown at a time. Additionally, paging UI is also shown at the
bottom of the DataGrid for navigating through the records. The paging UI allows
you to navigate backwards and forwards through displayed data, displaying a
fixed number of records at a time.
But there is a slight wrinkle in this. Paging with DataGrid
requires that all the data needs to be bound to the grid. If 100,000 records
are there, 99,975 records would be discarded on each request (assuming a page
size of 25).
A better approach to avoid this is to use the stored
procedure. SP should include logic for returning only the required number of
rows for each request.