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

[Solved] Multiple Grid Client Side Paging with one Event

1 Answer 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 21 Jul 2009, 02:07 PM
I have 2 grids on 1 page and I am trying to change the page of each grid in one client side event.  What is happening is the last call is the only one that is performed.  I have tried multiple ways of changing the page. And still get the same result.  Is this a known issue and is there a workaround.
TableView1 = $find("<%= TableView1.ClientID %>").get_masterTableView();  
TableView2 = $find("<%= TableView2.ClientID %>").get_masterTableView();  
 
function ChangePages(argument) {  
//Method 1  
TableView1.page(argument);  
TableView2.page(argument);  
//Method 2  
TableView1.set_currentPageIndex(page);  
TableView2.set_currentPageIndex(page);  

Thanks

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 24 Jul 2009, 01:49 PM
Hello Justin,

Client method set_currentPageIndex() makes post back, which will prevent executing of the of next JavaScript methods.

The workaround is to use RadAjaxManager's ajaxRequest client method and set the current page of the both grids and rebind them:

[JavaScript]:
function changePage()  
            { 
                $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest("ChangePage:1"); 
            } 

[C#]:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) 
    { 
        string[] arguments = e.Argument.Split(':'); 
        if (arguments[0] == "ChangePage")  
        { 
            rgTestWithDifferentBindWay.MasterTableView.CurrentPageIndex = Convert.ToInt32(arguments[1]); 
            RadGrid1.MasterTableView.CurrentPageIndex = Convert.ToInt32(arguments[1]); 
            rgTestWithDifferentBindWay.Rebind(); 
            RadGrid1.Rebind(); 
        } 
    } 

Kind regards,
Georgi Krustev
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
Justin
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or