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

Issues with using fireCommand on multiple grids

5 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike Dennis
Top achievements
Rank 1
Mike Dennis asked on 10 May 2011, 04:50 PM
I have two RadGrids that have selectable rows that popup RadWindows.  When the windows close, I refresh the RadGrids to apply changes made in the windows.  I do this by using fireCommand with a sort (at the time I created this kind of logic with another app, sort was the only command that seemed to work all the time to refresh).  It works fine if I just refresh one grid that way, but if I try to do two, neither refreshes.  Do I need to do something extra to get both grids to fire a command in the same javascript function?

5 Answers, 1 is accepted

Sort by
0
Mike Dennis
Top achievements
Rank 1
answered on 11 May 2011, 09:26 PM
If it isn't possible, is there another way to refresh both?  I tried a few different methods that I could find, but they didn't seem to work.  The code I tried in my onClose function of the RadWindowManager on the parent page is below.

var oRadGrid1 = $find("<%= RadGrid1.ClientID %>");
if (oRadGrid1 != null) {
    var mtRadGrid1 = oRadGrid1.get_masterTableView();
    mtRadGrid1.fireCommand("Sort", "");
}
var oRadGrid2 = $find("<%= RadGrid2.ClientID %>");
if (oRadGrid2 != null) {
    var mtRadGrid2 = oRadGrid2.get_masterTableView();
    mtRadGrid2.fireCommand("Sort", "");
}
0
Mira
Telerik team
answered on 13 May 2011, 11:17 AM
Hello Mike,

I assume the cause of the issue is that when the Sort command fires for the first grid, the whole page postbacks.
In order to implement the desired functionality, I suggest that you refresh the both grids calling the RadAjaxManager.ajaxRequest method:
JavaScript
function WindowOnClose(args) {
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("SortGrids");
}
C#
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    if (e.Argument == "SortGrids")
    {
        //sort the grids here
    }           
}

I hope this helps.

Kind regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mike Dennis
Top achievements
Rank 1
answered on 13 May 2011, 03:40 PM
Would I need to use some certain methods from the code behind to update the RadGrids?  I need the grid items to be refreshed.  Sorting the way I had been did that.  I tried DataBind(), Rebind(), and RaisePostBackEvent with a few different commands, but it doesn't seem to refresh the data in the grids.  I can see that the code behind is getting run when debugging, but it just doesn't update the grid..  What happens in the RadGrid could cause items to be added to, deleted from, or modified in the RadGrids on the parent page.
0
Accepted
Mira
Telerik team
answered on 18 May 2011, 09:01 AM
Hello Mike,

Rebinding the grids should be enough to refresh them. You can see how it is done in this demo.

If the issue persists, please provide a little bit more details on your scenario and how the grid is data-bound. Sending us a sample runnable project will be highly appreciated.

Greetings,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mike Dennis
Top achievements
Rank 1
answered on 19 May 2011, 07:25 PM
That seems to work.  I think the issue I had with it before was that I didn't have the ajax manager listed in itself as a control that could cause others to be updated.  I guess I had thought that would have been implied..
Tags
Grid
Asked by
Mike Dennis
Top achievements
Rank 1
Answers by
Mike Dennis
Top achievements
Rank 1
Mira
Telerik team
Share this question
or