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

[Solved] row count change resets pagination

3 Answers 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Teodorico
Top achievements
Rank 1
Teodorico asked on 21 Jul 2009, 02:40 AM

Hi,

I am facing the following scenario using client-side data binding:

1) User "A" gets a list of items and first page is displayed.
2) User "A" clicks next page and navigates to page 2 without any issues.
3) User "B" on another workstation adds a new item.
4) User "A" clicks next page to

<telerik:RadGrid     
    ID="RadGrid"    
    runat="server"    
    AllowPaging="true"    
    PageSize="25"    
    Width="100%"    
    Height="100%"    
    style="border:0px;outline:none"    
    >    
    <MasterTableView TableLayout="Auto" ClientDataKeyNames="Id, Icon, IsPrivate">     
        <Columns>    
            <telerik:GridBoundColumn DataField="Icon" HeaderText="" HtmlEncode="false" HeaderStyle-Width="26px"></telerik:GridBoundColumn>    
            <telerik:GridBoundColumn DataField="Name" HeaderText="Item" HtmlEncode="false" HeaderStyle-Width="100%"></telerik:GridBoundColumn>    
        </Columns>    
    </MasterTableView>    
    <ClientSettings EnableRowHoverStyle="true">     
        <Selecting AllowRowSelect="true" />    
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />    
        <DataBinding Location="Grid.aspx" SelectMethod="Search" FilterParameterType="String" SortParameterType="String" ></DataBinding>     
        <ClientEvents OnDataBinding="RadGrid_DataBinding" OnRowClick="RadGrid_RowClick" OnRowDblClick="RadGrid_RowDblClick" OnDataBound="RadGrid_DataBound" />    
    </ClientSettings>    
    <PagerStyle Mode="Slider" />    
</telerik:RadGrid>    
 

navigate to page 3, but the grid is reset to page 1.

 

I was able to pinpoint this to the fact that "count" changed. I can somehow understand a reason behind this, but in a multiuser environment this becomes really annoying for users.

Also, I noticed that the SelectMethod get called 3 times, one for page 3 and two times for page 0.

 

Is there a way to prevent this behavior.

 

Thanks.


3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 23 Jul 2009, 03:37 PM
Hello Teodorico,

Could you please make the static methods used for the client-side data-binging non-static and see if it makes any difference?

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Teodorico
Top achievements
Rank 1
answered on 23 Jul 2009, 10:33 PM
Lana,
I changed the method from:
[WebMethod]  
public static Helix.Flp.Web.Grid.ResultSet Search(int startRowIndex, int maximumRows, Helix.Flp.Core.Model.Food.FoodInfo.SearchCriteria criteria)  
 

To:
[WebMethod]  
public Helix.Flp.Web.Grid.ResultSet Search(int startRowIndex, int maximumRows, Helix.Flp.Core.Model.Food.FoodInfo.SearchCriteria criteria)  
 


But then I get a JavaScript exception:
Error: Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON.
Parameter name: data

Is there anything else I need to do?

Thanks.
0
Iana Tsolova
Telerik team
answered on 27 Jul 2009, 11:52 AM
Hello Teodorico,

It seems I was wrong when asked to make the methods non-static. Please excuse me for misleading you.
However, an option the described behavior is if you are saving the CurrentPageIndex for the grid into a static variable. Could you please send me your WebService definition for further investigation?
Additionally, if you can provide a live Url where we could test the unexpected behavior might be of help.

Thank you for your cooperation.
Regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Teodorico
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Teodorico
Top achievements
Rank 1
Share this question
or