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

Client side rebind on two grids in one method

3 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lilleliz
Top achievements
Rank 1
lilleliz asked on 03 Aug 2010, 12:52 PM
Hi I'm having a bit of a frustrating problem. I have to different grids in the same page and after an operation performed in a radwindow I want both of these grids rebinded. 

the javascript method is straight forward:

function OnClientClose(oWnd) {
                    var masterTable2 = $find("<%= SendingRadGrid.ClientID %>").get_masterTableView();
                    masterTable2.rebind();
                    var masterTable1 = $find("<%= OrderedRadGrid.ClientID %>").get_masterTableView();
                    masterTable1.rebind();
}

Both grids have a NeedDataSource method but strangely only the second one gets called. I actually tried to change the order and that changed which grid got rebinded. Seems like a bug to me. Any workarounds?

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 06 Aug 2010, 07:17 AM
Hello Lilleliz,

Generally rebind() method will request the server (post-back or ajax request if the grid is ajaxified). The second rebind may not be able to reach the server. Such approach will be successful only if the grid data-binding is asynchronous - for example client-side data-binding.
I suggest you to ajaxify your grids with RadAjaxManager and perform the required update as below:
In OnClientClose function:
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest();

In server side RadAjaxManager1_AjaxRequest event handler:
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
      grid1.Rebind();         
      grid2.Rebind();
}

Thus you can rebind the grids in one call back.

Sincerely yours,
Radoslav
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
lilleliz
Top achievements
Rank 1
answered on 06 Aug 2010, 09:04 AM
Thanks for your help. That worked like a charm!

Lilleliz
0
Rebecca
Top achievements
Rank 1
answered on 06 Feb 2018, 11:05 PM
Wow, thanks, I was looking for the answer to this for ages. Perfect.
Tags
Grid
Asked by
lilleliz
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
lilleliz
Top achievements
Rank 1
Rebecca
Top achievements
Rank 1
Share this question
or