This documentation is archived and is not being maintained.

How to: Enable Default Paging in the GridView Web Server Control

If you are using the ASP.NET GridView control with large amounts of data, you might want to page through the rows and display a subset of the rows on each page. The GridView control has built-in support for paging.

To enable paging using the smart tag panel

  1. In Design view, right-click the GridView control and select Show Smart Tag.

  2. In the smart tag panel, select Enable Paging.


    The Enable Editing check box appears in the smart tag panel only if the data source control to which GridView control is bound supports paging.

To enable paging in the Properties window

  • Select the GridView control, and in the Properties window, set AllowPaging property to true.

To enable default paging declaratively

  • In Source view, set the AllowPaging attribute of the <asp:GridView> element to true, as in the following example:

    <asp:GridView Runat="server" ID="GridView1" AllowPaging="true" />

Setting Paging Appearance

You can set the size of your page to specify how many rows are displayed at once. In addition, you can set the style of the links used to create navigation buttons. You can choose from the following types:

  • Next and previous buttons. The button captions can be any text you want.

  • Page numbers, which allow users to jump to a specific page. You can specify how many numbers are displayed; if there are more pages, an ellipsis (...) is displayed next to the numbers.

To change the number of rows displayed per page

  • Select the GridView control, and in the Properties window, set PageSize to the number of rows you want to display per page.

To specify default paging with Next and Previous buttons

  1. Set the GridView control to allow paging.

  2. In the Properties window, expand the PagerSettings node.

    Set Node to NextPrevious.

See Also