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

Unable to Set RadDataPager current index exists in RadListView using Javascript

1 Answer 23 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Phani
Top achievements
Rank 1
Phani asked on 24 Aug 2015, 06:19 AM
Dear Team,

 

I'm using RadDataPager inside a ListView. I need to reset the current page index to 1 in one specific scenario using javascript.

 

I'm using the below javascript code to reset the grid. but it is unable to find the DataPager Control. Please help on achieving the required functionality. 

var gridImages = $find("#<%=RadDataPagerLibraryVideos.ClientID %>");
gridImages.set_currentPageIndex(1);

 

ListView:

 
<telerik:RadListView CssClass="thumbnail" AllowPaging="true" ItemPlaceholderID="VideosHolder" runat="server" ID="LibraryVideoListView" DataKeyNames="AssetID" OnNeedDataSource="LibraryVideoListView_NeedDataSource" OnItemDataBound="LibraryVideoListView_ItemDataBound">
                          <LayoutTemplate>
                                     <fieldset id="LibraryVideoListView">
                                  <telerik:RadDataPager ID="RadDataPagerLibraryVideos" runat="server" PagedControlID="LibraryVideoListView"
                                      PageSize="15" OnPageIndexChanged="RadDataPagerLibraryVideos_PageIndexChanged">
                                      <Fields>
                                          <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                                          <telerik:RadDataPagerButtonField FieldType="Numeric" />
                                          <telerik:RadDataPagerButtonField FieldType="NextLast" />
                                          <telerik:RadDataPagerPageSizeField PageSizeText="Page size: " />
                                          <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go"
                                              TextBoxWidth="15" />
                                          <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>
                              <div class="horizontal-list center-block">
                                  <asp:Panel ID="VideosHolder" runat="server" />
                              </div>
                          </LayoutTemplate>
                          <ItemTemplate>
                              <div class="imgLibraryItem">
                                  <a href="#" class="videoSelected thumbnail has-hover" assetid='<%# Eval("AssetID") %>'>
                                      <asp:Image runat="server" ID="imgVideoThumbnail" CssClass="libraryImg" />
                                  </a>
                              </div>
                          </ItemTemplate>
                      </telerik:RadListView>

 

Thanks in Advance,

Phani

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 24 Aug 2015, 02:27 PM
Hi Phani,

You can use the fireCommand method provided by the RadListView to achieve this requirement:
http://docs.telerik.com/devtools/aspnet-ajax/controls/listview/client-side-programming/radlistview/methods/firecommand

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
Phani
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or