RadControls for ASP.NET AJAX
SEO paging of RadDataPager gets better results on search engines. In order to use SEO paging of the
RadDataPager control you need to set the AllowSEOPaging property to
True. When it is False (its default value), the RadDataPager does not use SEO paging.
In addition, you can specify the query page key for the grid that is used as part of the page
query by setting the SEOPagingQueryPageKey property. This is useful when the
data pager resides in several containers and its id becomes too long and not very readable. Using
SEOPagingQueryPageKey property you get much more search engine optimized links
to the other pages.
CopyASPX
<telerik:RadListView runat="server" ID="RadListView1" DataSourceID="SqlDataSource1"
DataKeyNames="CustomerID" AllowPaging="true" PageSize="7" ItemPlaceholderID="itemPlaceholder">
<LayoutTemplate>
<table style="width: 870px; background-color: #D9DFDF;">
<tr>
<th id="Th1" runat="server">
CustomerID
</th>
<th id="Th2" runat="server">
CompanyName
</th>
<th id="Th3" runat="server">
ContactName
</th>
<th id="Th4" runat="server">
ContactTitle
</th>
</tr>
<tr runat="server" id="itemPlaceholder" />
</table>
<fieldset style="text-align: center; background-color: #D9DFDF; width:850px">
<telerik:RadDataPager ID="RadDataPager1" runat="server" SEOPagingQueryPageKey="CurrentPageKey"
PagedControlID="RadListView1" AllowSEOPaging="true" PageSize="7">
<Fields>
<telerik:RadDataPagerButtonField FieldType="FirstPrev" />
<telerik:RadDataPagerButtonField FieldType="Numeric" />
<telerik:RadDataPagerButtonField FieldType="NextLast" />
<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.StartRowIndex + Container.Owner.PageSize %>" />
of
<asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount %>" />
<br />
</b>
</div>
</PagerTemplate>
</telerik:RadDataPagerTemplatePageField>
</Fields>
</telerik:RadDataPager>
</fieldset>
</LayoutTemplate>
<EmptyDataTemplate>
<legend>Customers</legend>No records for customers are available at this time.
</EmptyDataTemplate>
<AlternatingItemTemplate>
<tr id="Tr2" runat="server" bgcolor="#ccffff">
<td>
<asp:Label ID="CustomerID" runat="Server" Text='<%#Eval("CustomerID") %>' />
</td>
<td valign="top">
<asp:Label ID="CompanyName" runat="Server" Text='<%#Eval("CompanyName") %>' />
</td>
<td valign="top">
<asp:Label ID="ContactName" runat="Server" Text='<%#Eval("ContactName") %>' />
</td>
<td valign="top">
<asp:Label ID="ContactTitle" runat="Server" Text='<%#Eval("ContactTitle") %>' />
</td>
</tr>
</AlternatingItemTemplate>
<ItemTemplate>
<tr id="Tr2" runat="server" bgcolor="#99ccff">
<td>
<asp:Label ID="CustomerID" runat="Server" Text='<%#Eval("CustomerID") %>' />
</td>
<td valign="top">
<asp:Label ID="CompanyName" runat="Server" Text='<%#Eval("CompanyName") %>' />
</td>
<td valign="top">
<asp:Label ID="ContactName" runat="Server" Text='<%#Eval("ContactName") %>' />
</td>
<td valign="top">
<asp:Label ID="ContactTitle" runat="Server" Text='<%#Eval("ContactTitle") %>' />
</td>
</tr>
</ItemTemplate>
</telerik:RadListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address] FROM [Customers]" />In case you need to set the paging settings programmatically, you have to do it on an early stage from the page life cycle.
Hence, you can use the Page_PreInit or the Init event handler of the pager:
CopyC#
protected void RadDataPager1_Init(object sender, EventArgs e)
{
RadDataPager1.PageSize = 3;
RadDataPager1.AllowSEOPaging = true;
}
CopyVB
Protected Sub RadDataPager1_Init(sender As Object, e As EventArgs) Handles RadDataPager1.Init
RadDataPager1.PageSize = 3
RadDataPager1.AllowSEOPaging = True
End Sub