Answer: The DataPager serves as an external control to provide paging features. The DataPager class is used to page data and to display navigation controls for data-bound controls that implements the IPageableItemContainer interface and also associates the DataPager control with the data bound control. It provides a navigation bar on top or on bottom of the page (or both) to navigate to other pages according to the user's requirement. Below there is a description about different page field types.
NextPreviousPagerField -Enables users to navigate through pages one page at a time, or to jump to the first or last page.
NumericPagerField - Enables users to select a page by page number.
TemplatePagerField - Enables you to create a custom paging UI.
Below is the sample code to create a datapager:
<asp: datapager PageSize="10" ID="DataPager1" runat="server" PagedControlID="ListView1">
<fields>
<asp:nextpreviouspagerfield ButtonType="Link" ShowPreviousPageButton="True" ShowNextPageButton="False"/>
<asp:numericpagerfield />
<asp:nextpreviouspagerfield ButtonType="Link" ShowPreviousPageButton="False" ShowNextPageButton="True" />
</fields>
</asp:datapager>
Asked In: Many Interviews |
Alert Moderator