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

RadGrid javascript fireCommand("RebindGrid") not working for multiple grids

5 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Holdorf
Top achievements
Rank 1
Steve Holdorf asked on 05 Feb 2014, 05:05 PM
I have a JavaScript function that calls mastertable.fireCommand("RebindGrid") on several grids in that main function; however, when the function is called some of the grids refresh (rebind) and some do not?

Code:

function CloseAndRefresh () {

var masterTable1 = $find("<%= radGrid1.ClientID %>").get_masterTableView();
var masterTable2 = $find("<%= radGrid2.ClientID %>").get_masterTableView();

masterTable1.fireCommand("RebindGrid");
masterTable2.fireCommand("RebindGrid");

}

Now, here the radGrid2 data appears to be updated; however, the radGrid1 retains the same data and does not appear to update. One note is that my CloseAndRefresh() function is being called from a RadWindow OnClientClose javascript call. Now, in the RadWindow I am changing the edited item to go from one grid to the other.

Please help!


Steve Holdorf

5 Answers, 1 is accepted

Sort by
0
Steve Holdorf
Top achievements
Rank 1
answered on 05 Feb 2014, 06:18 PM
It's me again. What seems to be happening is that the order of the grid rebinding plays a big deal here. If you switch the order of grid rebinding then the first rebind grid gets updated but the second rebind does nothing. Is this a sync problem?
0
Steve Holdorf
Top achievements
Rank 1
answered on 06 Feb 2014, 02:19 PM
One more time it's me. After talking with my colleges we have determined that an entire AJAX postback, not a full postback, needs to occur once the RAD window closes. The problem is that all of the page's rad controls are in a html table with some wrapped in rad ajax panels and other not. Now, at the top of the aspx page we have the following:

< the ajax rad manager>
    <AjaxSettings>
        <UpdateControls>
            <telerik:AjaxUpdateControl ControlID="RadGrid1" />
            ...etc
          </UpdateControls>
    </AjaxSettings>
</ the ajax rad manager>
<table id="MainTable" runat="server" ...>
...etc

I know that this is not the complete markup; however, I can't cut and past to my internet computer; however, I hope that this is enough to help you understand what I have. Please provide any help you can.

Thanks,

Steve Holdorf
0
Steve Holdorf
Top achievements
Rank 1
answered on 06 Feb 2014, 07:36 PM
Still having problems; however, I know my needdatasource events are being called via brake point. Now, I have tried the following in the javascript which does run when the radwindow closes; however, the grids and UI does not get updated.

function CloseAndRefresh () {

ajaxRequest = new XMLHTTPRequest;
ajaxRequest.onreadystatechange = responsehandler;
ajaxRequest.open("GET", "thewebpage.aspx", true);
ajaxRequest.send(null);

}

Also,  I put an alert in the responsehandler function and the alert gets called.

Still stuck. Any help would be great!
0
Steve Holdorf
Top achievements
Rank 1
answered on 07 Feb 2014, 07:25 PM
Got it working! What I did way register the controls in the AjaxSetting portion of the webpage, added the OnAjaxManager_AjaxRequest event handler and then did a rebind() to each grid needing to be updated.
0
Michael
Top achievements
Rank 1
answered on 07 Jan 2015, 10:00 PM
Steve,
Could you elaborate on how you solved this issue?  I am having the same problem and nothing that I have tried up until now works.  The first grid gets updated and the second does nothing.

Thanks.
Tags
Grid
Asked by
Steve Holdorf
Top achievements
Rank 1
Answers by
Steve Holdorf
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or