This is a migrated thread and some comments may be shown as answers.

When I add datapager the paging and sorting does not work

1 Answer 48 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Tareq
Top achievements
Rank 1
Tareq asked on 23 Apr 2013, 06:21 PM
HI,

I followed the code example from here: http://demos.telerik.com/aspnet-ajax/grid/examples/programming/alphabeticpaging/defaultvb.aspx?#qsf-demo-source

Now the Alpha paging works great but the numeric paging when I click on any page it comes completely balnk
When I click on enable sorting and click on it comes blank

Is there something missing in the demo site code
<%@ Page Title="" Language="VB" MasterPageFile="~/AdminPanel/Admin.master" AutoEventWireup="false" CodeFile="pager_test.aspx.vb" Inherits="AdminPanel_franchise_pager_test" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
  
    <br />
    <hr />
    <div style="border: 5px solid #eaf2fd; width: 95%;">
        <telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource2" AllowPaging="True" PageSize="5"
            runat="server" GridLines="None" Width="100%" AllowSorting="True"
            CellSpacing="0">
            <PagerStyle Mode="NextPrevAndNumeric" EnableSEOPaging="False"></PagerStyle>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
            <AlternatingItemStyle HorizontalAlign="Center"></AlternatingItemStyle>
            <MasterTableView CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"
                    Created="True"></ExpandCollapseColumn>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                <CommandItemTemplate>
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                </CommandItemTemplate>
            </MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
    </div>
    <br />
  
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"  ConnectionString="<%$ ConnectionStrings:SQL %>"
         
        SelectCommand="SELECT [a], [b], [c], [d], [e] FROM [franchises] WHERE ([xyz] LIKE @xyz)">
        <SelectParameters>
            <asp:Parameter Name="xyz" Type="String" DefaultValue="%" />
        </SelectParameters>
    </asp:SqlDataSource>
 
</asp:Content>

Protected Sub RadGrid2_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid2.ItemCreated
       If TypeOf e.Item Is GridCommandItem Then
           Dim commandItem As GridCommandItem = CType(e.Item, GridCommandItem)
           Dim container As PlaceHolder = commandItem.FindControl("PlaceHolder1")
 
           Dim i As Integer
           For i = 65 To 65 + 25
               Dim linkButton1 As New LinkButton
               Dim lc As New LiteralControl("  ")
               linkButton1.Text = "" + ChrW(i)
 
               linkButton1.CommandName = "alpha"
               linkButton1.CommandArgument = "" + ChrW(i)
 
               container.Controls.Add(linkButton1)
               container.Controls.Add(lc)
           Next i
 
           Dim lcLast As New LiteralControl(" ")
           container.Controls.Add(lcLast)
 
           Dim linkButtonAll As New LinkButton
           linkButtonAll.Text = "All"
           linkButtonAll.CommandName = "NoFilter"
           container.Controls.Add(linkButtonAll)
       End If
   End Sub
 
   Protected Sub RadGrid2_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid2.ItemCommand
       Dim value As String = Nothing
       Select Case e.CommandName
           Case ("alpha")
               value = String.Format("{0}%", e.CommandArgument)
               Exit Select
           Case ("NoFilter")
               value = "%"
               Exit Select
       End Select
       SqlDataSource2.SelectParameters("xyz").DefaultValue = value
       RadGrid2.Rebind()
   End Sub

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Apr 2013, 04:29 PM
Hi,

I tried to replicate the described problem in our online example, but to no avail. Can you specify what is the difference in your case? Also let us know which is the version of Telerik controls you are using.

Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
DataPager
Asked by
Tareq
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or