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

RadAjaxManager AJAXRequest with 2 RadGrids

3 Answers 80 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
GP
Top achievements
Rank 1
GP asked on 14 Dec 2011, 04:55 PM
Good morning.  I have 2 grids that use a RadWindow to do their Insert/Updates.  I have them returning and updating properly.  The only problem is that I noticed is that when I update one grid, both grids are refreshed by the ajax manager.  I'd like to see only one grid refresh at a time.

Below is the AJAX setting to allow the rebinds to happen.
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>
        <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1"/>
    </UpdatedControls>
</telerik:AjaxSetting>

Below is the call to refresh the grids based on type.  I'm mostly sending you this so that you can see the AJAX call.
function refreshGrid(args, type) {
    if (type == "A") {
        if (args == 1) {
            radalert("Action Updated");
        }
        else {
            radalert("Action Added");
        }
        $find("<%= RadAjaxManager.GetCurrent(me).ClientID %>").ajaxRequest("RebindActions");
    }
    else {
        if (args == 1) {
            radalert("Record Updated");
        }
        else {
            radalert("Record Added");
        }
        $find("<%= RadAjaxManager.GetCurrent(me).ClientID %>").ajaxRequest("RebindRecords");
    }
     
}


Is there a way to only refresh one of these grids at a time?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 16 Dec 2011, 06:01 PM
Hello,

Use such settings that each grid to update only itself.
<telerik:AjaxSetting AjaxControlID="RadGrid1">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>
    </UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGrid2">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1"/>
    </UpdatedControls>
</telerik:AjaxSetting>

Then when you need to perform Ajax call, just fire custom command using .fireCommand() client method of the MasterTableView of one of the grids.

I hope this help.

Regards,
Vasil
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
0
GP
Top achievements
Rank 1
answered on 18 Dec 2011, 05:21 PM
This only works if data is already loaded into the Radgrid.  If initially, no records return, and the grid has the message "No Data to display", then the mastertable is not there to rebind.
0
GP
Top achievements
Rank 1
answered on 18 Dec 2011, 05:39 PM
Got it.  You put me on the right trail, so thank you.  Here was the solution that worked for me.

var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
masterTable.rebind();
Tags
Ajax
Asked by
GP
Top achievements
Rank 1
Answers by
Vasil
Telerik team
GP
Top achievements
Rank 1
Share this question
or