When I add datapager the paging and sorting does not work

2 posts, 0 answers
  1. Tareq
    Tareq avatar
    1 posts
    Member since:
    Apr 2013

    Posted 23 Apr 2013 Link to this post

    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

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 26 Apr 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top