John Mitchell
Top achievements
Rank 1
John Mitchell
asked on 07 Oct 2010, 04:14 PM
Hiya,
I'm using a RadListView bound to a ObjectDataSource and using a RadDataPager to allow paging (its a simple forum application). One of the features I'm trying to have is to automatically jump to a specific page depending on the url i.e
/forum.aspx?topic=1 would jump to the first page where as
/forum.aspx?topic=1&reply=997 might jump to the 10th page.
To accomplish this, I've setup a RadListView_DataBound component which quite simply tries to jump to the correct page which holds the post id :-
The problem I seem to have is that even after setting CurrentPageIndex, the page doesn't change.
Any ideas?
Thanks!
mitch
I'm using a RadListView bound to a ObjectDataSource and using a RadDataPager to allow paging (its a simple forum application). One of the features I'm trying to have is to automatically jump to a specific page depending on the url i.e
/forum.aspx?topic=1 would jump to the first page where as
/forum.aspx?topic=1&reply=997 might jump to the 10th page.
To accomplish this, I've setup a RadListView_DataBound component which quite simply tries to jump to the correct page which holds the post id :-
protected void RadListView1_DataBound(object sender, EventArgs e) { if (!IsPostBack && (Request.QueryString["post_id"] != null)) { //First get the page size int pageSize = RadListView1.PageSize; //Then get the reply_id int replyID = int.Parse(Request.QueryString["post_id"]); int iPage = 1; int iPageElementCount = pageSize; foreach(forumPost oPost in odsForumPosts.Select()) { if(oPost.ID == replyID) { RadListView1.CurrentPageIndex = iPage; return; } iPageElementCount--; if(iPageElementCount == 0) { iPage++; iPageElementCount = pageSize; } } } }The problem I seem to have is that even after setting CurrentPageIndex, the page doesn't change.
Any ideas?
Thanks!
mitch
10 Answers, 1 is accepted
0
John Mitchell
Top achievements
Rank 1
answered on 10 Oct 2010, 07:52 PM
Anyone?
0
Hi John,
Please, refer to the other support ticket post for additional information. To avoid duplicate posts, I suggest that we continue our communication there.
All the best,
Pavlina
the Telerik team
Please, refer to the other support ticket post for additional information. To avoid duplicate posts, I suggest that we continue our communication there.
All the best,
Pavlina
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
John Mitchell
Top achievements
Rank 1
answered on 13 Oct 2010, 04:08 PM
0
Shay Grinstein
Top achievements
Rank 1
answered on 17 Jan 2011, 03:17 PM
Hi,
I'm having the same problem.
I need to return to the first page after setting:
RadListView1.DataSource = ds;
RadListView1.DataBind();
I cannot change RadListView1.CurrentPageIndex because it is readonly.
Where can I see a solution for this problem?
Regards,
Shay.
I'm having the same problem.
I need to return to the first page after setting:
RadListView1.DataSource = ds;
RadListView1.DataBind();
I cannot change RadListView1.CurrentPageIndex because it is readonly.
Where can I see a solution for this problem?
Regards,
Shay.
0
Hello Shay,
We are not able to determine the exact reason for issue you are facing without examining your code implementation in detail. For your convenience I have prepared a simple working project which handles a similar functionality. Please modify it so that I can replicate the issue. Thus I will do my best to find a quick resolution of this problem.
All the best,
Pavlina
the Telerik team
We are not able to determine the exact reason for issue you are facing without examining your code implementation in detail. For your convenience I have prepared a simple working project which handles a similar functionality. Please modify it so that I can replicate the issue. Thus I will do my best to find a quick resolution of this problem.
All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Shay Grinstein
Top achievements
Rank 1
answered on 18 Jan 2011, 01:33 PM
I have RadListView with RadDataPager and a RadComboBox.
I'm using RadComboBox client API: OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" to trigger databind to RadListView.
The databind is successfull and the data that I see in RadListView after the databind is the first page but RadDataPager still showing that it is on other page (and not the first page as RadListView shows).
I couldn't found client API for RadDataPager to set it's page index to the first page.
ASP.Net code:
Javascript code:
How can I set the RadDataPager page index on client?
I'm using RadComboBox client API: OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" to trigger databind to RadListView.
The databind is successfull and the data that I see in RadListView after the databind is the first page but RadDataPager still showing that it is on other page (and not the first page as RadListView shows).
I couldn't found client API for RadDataPager to set it's page index to the first page.
ASP.Net code:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <asp:Panel ID="ListViewPanel1" runat="server"> <div id="new_search"><div style="margin-top: 8px; float: left;"> <strong>Sort By:</strong> <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="75px" AutoPostBack="true" Skin="Simple" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" onselectedindexchanged="RadComboBox1_SelectedIndexChanged"> <Items> <telerik:RadComboBoxItem Value="1" Text="Posted" /> <telerik:RadComboBoxItem Value="2" Text="Updated" /> <telerik:RadComboBoxItem Value="3" Text="Creator" /> <telerik:RadComboBoxItem Value="4" Text="Favorites" /> <telerik:RadComboBoxItem Value="5" Text="Voyajed" /> <telerik:RadComboBoxItem Value="6" Text="Rating" /> <telerik:RadComboBoxItem Value="7" Text="Views" /> </Items> </telerik:RadComboBox> <strong>New search</strong></div> <asp:LinkButton ID="LinkButton2" runat="server" CssClass="linkbtn2" width="121px" height="29px" onclick="LinkButton2_Click">Search</asp:LinkButton> </div> <br /><br /><br /> <telerik:RadListView ID="RadListView1" runat="server" DataKeyNames="TripID" PageSize="5" ItemPlaceholderID="ResultsContainer" AllowPaging="True" onpageindexchanged="RadListView1_PageIndexChanged" onprerender="RadListView1_PreRender" ondatabound="RadListView1_DataBound"> <LayoutTemplate> <fieldset style="border:0px;"> <asp:PlaceHolder ID="ResultsContainer" runat="server" /> </fieldset> </LayoutTemplate> <ItemTemplate> <div class="trip_item"> <asp:Label ID="Label4" runat="server" Visible="false" Text='<%# Eval("TripID") %>' /> <div class="trip_icon"><a href="viewTrip.aspx?trip=<%# Eval("TripID") %>"><img src='<%# SetTripPic(Eval("TripID")) %>' width="59" height="59" border="0"/></a> </div> <div class="trip_summery"> <a style="text-decoration:none;" href="viewTrip.aspx?trip=<%# Eval("TripID") %>"><div style="float:left;"><asp:Image ID="Image1" runat="server" Width="" /></div><asp:Label ID="Label1" runat="server" Width="235px" Text='<%# Eval("TripName") %>' /></a><br /> By: <a href='<%# "personal/profile.aspx?user=" + SetBuilderName(Eval("TripBuilderID")) %>'><%# SetBuilderName(Eval("TripBuilderID")) %></a><br /> Posted: <asp:Label ID="Label2" runat="server" Text='<%# Eval("STBD") %>' /> Updated: <asp:Label ID="Label5" runat="server" Text='<%# Eval("STBD2") %>' /><br /> <span class="recommended">Community</span> </div> <div class="trip_stats">Views: <asp:Label ID="Label3" runat="server" Text='<%# Eval("TripViewsCount") %>' /> Favorites: <%# SetFav(Eval("TripID")) %> Voyajed: <%# SetVoy(Eval("TripID")) %> </div> <div class="stars"><telerik:RadRating ID="RadRating1" runat="server" Precision="Exact" Value='<%# Convert.ToDouble(Eval("TripUserRanking")) / (Convert.ToDouble(Eval("TripUserRankingCount")) + 0.000001) %>' ReadOnly="true" /></div> </div> </ItemTemplate> <EmptyDataTemplate> No Results to display. <br /> </EmptyDataTemplate> </telerik:RadListView><br /> <telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="5" PagedControlID="RadListView1"> <Fields> <telerik:RadDataPagerButtonField FieldType="FirstPrev" FirstButtonText="First" PrevButtonText="Prev" /> <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="5" /> <telerik:RadDataPagerButtonField FieldType="NextLast" NextButtonText="Next" LastButtonText="Last" /> </Fields> <ClientEvents OnPageIndexChanging="PageIndexChanging" OnDataPagerCreated="DataPagerCreated" /> </telerik:RadDataPager> <input type="hidden" runat="server" id="hidValue1" /> <input type="hidden" runat="server" id="hidValue2" /> <input type="hidden" runat="server" id="hidValue3" /> <input type="hidden" runat="server" id="hidValue4" /> <input type="hidden" runat="server" id="hidValue5" /> </asp:Panel> </telerik:RadCodeBlock>Javascript code:
<script type="text/javascript"> function PageIndexChanging(sender, eventArgs) { fillSearchResults2(); } function DataPagerCreated(sender, eventArgs) { fillSearchResults2(); } function OnClientSelectedIndexChanged(sender, eventArgs) { var listview = $find("<%= RadListView1.ClientID %>"); listview.page(0); }</script>How can I set the RadDataPager page index on client?
0
Hello John,
I recommend that you go through the following links and see if they help.
http://www.telerik.com/help/aspnet-ajax/datapager-getting-familiar-with-client-side-api.html
http://www.telerik.com/help/aspnet-ajax/datapager-onpageindexchanging.html
All the best,
Pavlina
the Telerik team
I recommend that you go through the following links and see if they help.
http://www.telerik.com/help/aspnet-ajax/datapager-getting-familiar-with-client-side-api.html
http://www.telerik.com/help/aspnet-ajax/datapager-onpageindexchanging.html
All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Shay Grinstein
Top achievements
Rank 1
answered on 20 Jan 2011, 09:52 AM
Yes it helped.
Solution was using:
Thanks,
Shay.
Solution was using:
var listviewpager = $find("<%= RadDataPager1.ClientID %>");listviewpager.set_newPageIndex(0);Thanks,
Shay.
0
Rohan
Top achievements
Rank 1
answered on 25 Feb 2013, 01:37 PM
Hi all,
How to add Page size to "All" option in RADDataPager Control ... please provide any link or example or document .
Thanks
How to add Page size to "All" option in RADDataPager Control ... please provide any link or example or document .
Thanks
0
Hello Rohan,
Did you try using PageSizes property for the RadDataPagerPageSizeField which is added since Q3 2011 to achieve your goal? It allows to customize the page size values that appear in RadComboBox.
Greetings,
Pavlina
the Telerik team
Did you try using PageSizes property for the RadDataPagerPageSizeField which is added since Q3 2011 to achieve your goal? It allows to customize the page size values that appear in RadComboBox.
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.