Top and Bottom RadDataPager

4 posts, 0 answers
  1. Angie
    Angie avatar
    101 posts
    Member since:
    Jan 2008

    Posted 09 May 2013 Link to this post

    Hello, I need assistance in getting my top pager and my bottom pager to remain in sync when the page is changed.  I am using a asp:DataList, so I've had to set the pager up so that it calls the "PageIndexChanged" event and the TotalRowCountRequest event. 

    Is there a way to have the other pager respond as well when the events are triggered on the first pager?

    Edit:  I would like to emphasize that I'm using the asp:DataList, not the ListView.  Thanks!

    Thanks!

    Here is the code:

    <telerik:RadDataPager ID="RadDataPager1" runat="server" OnPageIndexChanged="RadDataPager_PageIndexChanged" OnTotalRowCountRequest="RadDataPager_TotalRowCountRequest" OnPreRender="RadDataPager_PreRender" >
     <Fields>
        <telerik:RadDataPagerTemplatePageField HorizontalPosition="LeftFloat">
            <PagerTemplate>
                <div style="float: right;color:#666666;">
                    Displaying items
                        <asp:Label runat="server" ID="PageItemFromLabel"  />
                        to
                        <asp:Label runat="server" ID="PageItemToLabel"  />
                        of
                        <asp:Label runat="server" ID="TotalItemsLabel"  />
                        
                </div>
            </PagerTemplate>
        </telerik:RadDataPagerTemplatePageField>
         <telerik:RadDataPagerButtonField FieldType="NextLast" HorizontalPosition="RightFloat" />
          <telerik:RadDataPagerButtonField FieldType="Numeric" HorizontalPosition="RightFloat" />
        <telerik:RadDataPagerButtonField FieldType="FirstPrev" HorizontalPosition="RightFloat" />
         
        </Fields>        
    </telerik:RadDataPager>
     
     
     
    <asp:DataList ID="lvUserImages" runat="server" OnNeedDataSource="lvUserImages_NeedDataSource" RepeatColumns=3 CellPadding=10 ItemStyle-VerticalAlign="Bottom" RepeatDirection="Horizontal" OnItemDataBound="lvUserImages_ItemDataBound"    >
            <ItemTemplate>
            <asp:HyperLink ID="hlPost" runat="server">
            <div class="imgWrapper" >
            <asp:Image ID="img" runat="server" style="max-width:300px"  />
            <div class="imgTextOverlay">
                    <%# Eval("subject") %><br />
                    Posted: <%# ((DateTime)Eval("postdate")).ToString("MM/dd/yyyy") %> | <%#Eval("replycount") %> replies
                </div>
                </div>
            </asp:HyperLink>
             </ItemTemplate>
        </asp:DataList>
     
     
     
        <telerik:RadDataPager ID="RadDataPager2" runat="server" OnPageIndexChanged="RadDataPager_PageIndexChanged" OnTotalRowCountRequest="RadDataPager_TotalRowCountRequest" OnPreRender="RadDataPager_PreRender" >
     <Fields>
        <telerik:RadDataPagerTemplatePageField HorizontalPosition="LeftFloat">
            <PagerTemplate>
                <div style="float: right;color:#666666;">
                    Displaying items
                        <asp:Label runat="server" ID="PageItemFromLabel"  />
                        to
                        <asp:Label runat="server" ID="PageItemToLabel"  />
                        of
                        <asp:Label runat="server" ID="TotalItemsLabel"  />
                        
                </div>
            </PagerTemplate>
        </telerik:RadDataPagerTemplatePageField>
         <telerik:RadDataPagerButtonField FieldType="NextLast" HorizontalPosition="RightFloat" />
          <telerik:RadDataPagerButtonField FieldType="Numeric" HorizontalPosition="RightFloat" />
        <telerik:RadDataPagerButtonField FieldType="FirstPrev" HorizontalPosition="RightFloat" />
         
        </Fields>        
    </telerik:RadDataPager>
  2. Marin
    Admin
    Marin avatar
    1044 posts

    Posted 14 May 2013 Link to this post

    Hello,

     The other pager cannot automatically respond to the events fired by the first pager so in this case you would have to keep them synchronized manually by setting the CurrentPageIndex and PageSize properties of the other pager as well when an event is fired.

    Greetings,
    Marin
    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
  4. Angie
    Angie avatar
    101 posts
    Member since:
    Jan 2008

    Posted 15 May 2013 Link to this post

    Marin, would you be so kind as to give me an idea of *how* to do that?  I've tried assigning a value to the RadDataPager.CurrentPageIndex, but I get a readonly error.
  5. Marin
    Admin
    Marin avatar
    1044 posts

    Posted 17 May 2013 Link to this post

    Hi,

     In this case it is better to use the FireCommand method from the server API of RadDataPager.
    I am also attaching a sample page showing this approach.

    Kind regards,
    Marin
    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.
Back to Top