Export (0) Print
Expand All

DataPager

To enable users to page through data in either a ListView control or a control that implements the IPageableItemContainer interface, you can use a DataPager control. The DataPager control can be inside the LayoutTemplate template or on the page outside the ListView control. If the DataPager control is not in the ListView control, you must set the PagedControlID property to the ID of the ListView control.

The DataPager control supports built-in paging user interface (UI). You can use the NumericPagerField object, which enables users to select a page of data by page number. You can also use the NextPreviousPagerField object. This enables users to move through pages of data one page at a time, or to jump to the first or last page of data. The size of the pages of data is set by using the PageSize property of the DataPager control. You can use one or more pager field objects in a single DataPager control.

You can also create custom paging UI by using the TemplatePagerField object. In the TemplatePagerField template, you can reference the DataPager control by using the Container property. This property provides access to the properties of the DataPager control. These properties include the starting row index, the page size, and the total number of rows currently bound to the ListView control.

The following illustration shows a layout that displays links to pages of data based on the page number, using the NumericPagerField object.

Cc295263.e5c26f00-56c1-4fae-ad13-a7c656993f04(en-us,Expression.40).png

The following illustration shows paging UI that displays links to the next, previous, first, and last pages of data by using the NextPreviousPagerField object. The paging UI also includes custom content from a TemplatePagerField template, which displays the current item number range and the total number of items. The TemplatePagerField template includes a text box where users can enter the number of an item to move to. The specified item is displayed as the first item on the page.

Cc295263.0d50cca1-928c-49a4-a8f5-4e9542ce6e08(en-us,Expression.40).png

For more information about this control, see DataPager Class Cc295263.xtlink_newWindow(en-us,Expression.40).png in the MSDN Library online.

See also

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft