With the help of this, you can manipulate the paging interface and set appropriate actions in the listview and the datapager.
A sample field collection would look like,
<asp:TemplatePagerField>
<PagerTemplate>
<b>Page <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.TotalRowCount>0 ?
(Container.StartRowIndex / Container.PageSize) + 1 : 0 %>" />
of
<asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Math.Ceiling ((double)Container.TotalRowCount / Container.PageSize) %>" />
(<asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.TotalRowCount%>" />
records)
</PagerTemplate>
</asp:TemplatePagerField>
To set the properties from code-behind, you would need to have the following values:
a) DataPager control's Pagesize
b) The current page index
and then depending on your requirement, you would do something like below in the prerender event.
int PageSize = dataPagerCtrl.PageSize;
dataPagerCtrl.SetPageProperties(CurrentPage * PageSize, PageSize, true);