The RadListView supports native paging and RadDataPager as external control to provide paging features. If you need a RadDataPager control to be used for navigating through a RadListView control data, you must set the PagedControlID property of RadDataPager to the ID of the RadListView control and the AllowPaging property of the listview to True. The size of the pages of data is set by using the PageSize property of the RadDataPager control.
<%@ Page Language="c#" Inherits="Telerik.DataPagerExamplesCSharp.FirstLook.DefaultCS" CodeFile="DefaultCS.aspx.cs" %><%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" %><%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %><%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %><%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <telerik:HeadTag runat="server" ID="Headtag2"></telerik:HeadTag> <style type="text/css"> .rdpWrap .RadInput, .rdpWrap .rdpPagerButton, .rdpWrap .rdpPagerLabel { float: left; } </style></head><body class="BODY"> <form runat="server" id="mainForm" method="post"> <div> <telerik:Header runat="server" ID="Header1" NavigationLanguage="CS" /> <!-- content start --> <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" /> <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Configurator" Expanded="true"> Use check boxes bellow to customize the RadDataPager control <asp:CheckBoxList runat="server" ID="CheckBoxList1" AutoPostBack="true" RepeatColumns="2" RepeatDirection="Vertical" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged" RepeatLayout="Table" CellSpacing="10"> <asp:ListItem Value="1" Text="FirstPrev button fields" Selected="True"></asp:ListItem> <asp:ListItem Value="2" Text="Numeric button fields" Selected="True"></asp:ListItem> <asp:ListItem Value="3" Text="NextLast button fields" Selected="True"></asp:ListItem> <asp:ListItem Value="4" Text="Page size field" Selected="True"></asp:ListItem> <asp:ListItem Value="5" Text="Go-to-page field" Selected="True"></asp:ListItem> <asp:ListItem Value="6" Text="Template field" Selected="True"></asp:ListItem> </asp:CheckBoxList> </qsf:ConfiguratorPanel> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="ListViewPanel1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="ListViewPanel1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="CheckBoxList1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="CheckBoxList1" /> <telerik:AjaxUpdatedControl ControlID="ListViewPanel1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="0" /> <asp:Panel ID="ListViewPanel1" runat="server"> <telerik:RadListView ID="RadListView1" Width="97%" AllowPaging="True" runat="server" AllowSorting="true" DataSourceID="SqlDataSource1" ItemPlaceholderID="ProductsHolder" DataKeyNames="ProductID"> <LayoutTemplate> <fieldset style="width: 760px;" id="FieldSet1"> <legend>Products</legend> <asp:Panel ID="ProductsHolder" runat="server" /> <table cellpadding="0" cellspacing="0" width="100%;" style="clear: both;"> <tr> <td> <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1" PageSize="6"> <Fields> <telerik:RadDataPagerButtonField FieldType="FirstPrev" /> <telerik:RadDataPagerButtonField FieldType="Numeric" /> <telerik:RadDataPagerButtonField FieldType="NextLast" /> <telerik:RadDataPagerPageSizeField PageSizeText="Page size: " /> <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go" TextBoxWidth="15" /> <telerik:RadDataPagerTemplatePageField> <PagerTemplate> <div style="float: right"> <b>Items <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.Owner.StartRowIndex+1%>" /> to <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.Owner.TotalRowCount > (Container.Owner.StartRowIndex+Container.Owner.PageSize) ? Container.Owner.StartRowIndex+Container.Owner.PageSize : Container.Owner.TotalRowCount %>" /> of <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" /> <br /> </b> </div> </PagerTemplate> </telerik:RadDataPagerTemplatePageField> </Fields> </telerik:RadDataPager> </td> </tr> </table> </fieldset> </LayoutTemplate> <ItemTemplate> <div style="float: left;"> <table cellpadding="0" cellspacing="0" style="width: 230px; height: 100px"> <tr> <td style="width: 20%;"> Name: </td> <td style="width: 80%; padding-left: 5px;"> <%# Eval("ProductName") %> </td> </tr> <tr> <td> Quantity: </td> <td style="width: 80%; padding-left: 5px;"> <%# Eval("QuantityPerUnit") %> </td> </tr> <tr> <td> Price: </td> <td style="width: 80%; padding-left: 5px;"> <%# DataBinder.Eval(Container.DataItem, "UnitPrice", "{0:C}") %> </td> </tr> <tr> <td> Units: </td> <td style="width: 80%; padding-left: 5px;"> <%# Eval("UnitsInStock") %> </td> </tr> <tr> <td> Available: </td> <td style="width: 80%; padding-left: 5px;"> <%# ((bool)DataBinder.Eval(Container.DataItem,"Discontinued") == false ? "Yes" : "No") %> </td> </tr> <tr> <td> <hr /> </td> <td> <hr /> </td> </tr> </table> </div> </ItemTemplate> </telerik:RadListView> </asp:Panel> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [ProductID], [ProductName], [QuantityPerUnit], [UnitPrice], [UnitsInStock], [Discontinued] FROM [Products]" /> <!-- content end --> <telerik:Footer runat="server" ID="Footer1"></telerik:Footer> </div> </form></body></html>
Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.
Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.
If you have any questions, do not hesitate to contact us at sales@telerik.com.