Viewing the Page
With the DataGridPager control in place, run the page and click the paging links. Notice that the paging now emulates the functionality described earlier. Figure 2
and Figure 3
show how the paging feature looks by default on the initial page and after the user pages into the data.
The DataGridPager Control's Properties
|Figure 2. Data Grid Pager on Page 1. Note that the paging links for the first and previous pages are grayed out when the DataGrid is on its first page. Also, the current page link appears in bold text. The control provides numbered page links for the next 10 pages.||
|Figure 3. Data Grid Pager on Page 12. With the DataGrid now on page 12, the DataGridPager control has automatically created numbered links for both the previous ten and the next ten pages. The control uses ten links by default, but you can control this by setting the MaxNumPageForwardLinks and MaxNumPageBackLinks properties.|
Now that you've seen the control in action, here are some of its other properties. You can view the control's properties easily by switching your page to Design view, selecting the DataGridPager control, and then looking at the Properties pane. Figure 4
shows these properties with their default values. Table 1 lists the properties and a description of each.
|Figure 4. DataGridPager's Properties: The default DataGridPager control properties.|
||The ID of the DataGrid to attach to.
||The text of the first page link. This property defaults to <<.
||The text of the last page link. This property defaults to >>.
||The text of the previous page link. This property defaults to < Previous.
||The text of the next page link. This property defaults to Next >.
||The maximum number of numbered page links to show after the current page indicator. This property defaults to 10.
||The maximum number of numbered page links to show before the current page indicator. This property defaults to 10.
||This property specifies the text used to separate the paging links. This property defaults to a space character.
You can set these properties in the properties pane, at run-time, or using attributes in the HTML for the page, for example:
<x:DataGridPager RunAt="server" Id="dgp"
PageLinkSeparator=" - " />