Skip to main content
CSharpUniversity ASP.NET and C# lessons

The search runs entirely in your browser over the published lesson list.

Paging through many rows

A grid with a thousand rows is unusable. Paging shows a slice at a time and gives the visitor a way to move between slices.

Turn it on

Markup
<asp:GridView id="productsGrid" runat="server"
    DataSourceID="productsSource"
    AllowPaging="true" PageSize="10" />

What to consider

  • Choose a page size that fits the screen without endless scrolling. Ten to twenty rows is a common choice.
  • Keep sorting and paging working together, so a sorted list stays sorted across pages.
  • For very large tables, fetch only the rows for the current page rather than all of them.
Think about the query. Paging that fetches every row and shows ten still pays for every row. On a large table, page in the database instead.

Add a search box next in searching from a form.

New lessons by email

Leave your address and get a short note whenever a fresh lesson is published. No account needed and you can stop at any time.

Thank you. Your address has been noted in this browser session. Connect a mailing service to deliver the notes for real.