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

Top and Bottom RadDataPager

3 Answers 71 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Angie
Top achievements
Rank 1
Angie asked on 09 May 2013, 09:14 PM
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>

3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 14 May 2013, 10:13 AM
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.
0
Angie
Top achievements
Rank 1
answered on 15 May 2013, 04:04 PM
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.
0
Marin
Telerik team
answered on 17 May 2013, 11:29 AM
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.
Tags
DataPager
Asked by
Angie
Top achievements
Rank 1
Answers by
Marin
Telerik team
Angie
Top achievements
Rank 1
Share this question
or