Paging, DataGrid Properties Dialog Box

 

The Paging tab of the DataGrid Properties dialog box allows you to specify options for how many items appear in the grid at once, and how users can navigate between pages.

Note

ASP.NET version 2.0 comes with a new server control, GridView, with more features than the DataGrid control. For more information, see Comparing the GridView and DataGrid Web Server Controls.

To access this dialog box

  1. In Microsoft Visual Web Developer, open or create an .aspx page.

  2. In Source view, add a DataGrid control to the page in the <form> element. Your code might look like the following:

    <form id="form1" runat="server">
        <div>
        <asp:DataGrid ID="DataGrid1" runat="server"></asp:DataGrid>
        </div>
    </form>
    
  3. Switch to Design view.

  4. Right-click the DataGrid control and click Show Smart Tag.

    The DataGrid Tasks window opens.

  5. Click Property Builder.

    The DataGrid Properties dialog box opens.

  6. Click the Paging tab.

Tasks

UI Elements

Paging

  • Allow paging
    Specifies whether the grid displays the data in pages. Selecting this check box causes the grid to include a navigation bar at the bottom with buttons to move between pages. In addition, it enables all other paging options in this tab.

    If this check box is cleared, the grid is rendered as long as necessary to display all the rows from the data source.

  • Allow custom paging
    Specifies that the grid will not automatically calculate which data records to display in the grid. Instead, you must provide the logic to create pages of information.

  • Page size
    Specifies the number of items to display at once in the grid. If the last page of the display does not contain enough data rows to meet the page size, the grid is shortened.

  • Show navigation buttons
    Specifies whether the grid includes a navigation bar. Clear this check box if you are providing custom navigation. Selecting this check box enables the other navigation options on this tab.

  • Position
    Specifies the location on the grid (top, bottom, or both) where the navigation bar is displayed.

  • Mode
    Specifies how navigation buttons are rendered: either as Next and Previous buttons (with text you specify) or as page numbers that users can click to move to a specific page.

  • Next page button text
    The text of the button that users click to move to the next page. The button text can be set to any HTML text (including tags). You can set the font and color of the button text on the Format tab.

  • Previous page button text
    The text of the button that users click to move to the previous page. The button text can be set to any HTML text (including tags). You can set the font and color of the button text on the Format tab.

  • Numeric buttons
    If you selected Page numbers for the Mode option, this option allows you to specify how many page numbers are displayed at a time on the grid. If the data source contains more pages than the number of page numbers you display, the grid includes an ellipsis (...) to allow users to move to the next set of page numbers. You can set the font and color of the button text on the Format tab.

See Also

Comparing the GridView and DataGrid Web Server Controls