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

Refresh Grid when RadWindow Closes?

2 Answers 137 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Darin
Top achievements
Rank 1
Darin asked on 27 Feb 2013, 04:30 PM
When a user closes the RadWindow I need to refresh the grid on the page where the RadWindow was opened to reflect the changes the user made in the RadWindow.  How do I do that?

2 Answers, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 27 Feb 2013, 04:56 PM
Hi Darin,

Assuming you've correctly updated the data by the time the RadWindow closes, you can perform any action you want when the Radwindoiw is closed using the OnClientClose event. Inside this event handler you can refresh data in the RadGrid one row at a time by using the updateItem method. If you are refreshing multiple rows the you will need to call this method multiple times.

Good luck,
Master Chief
0
Princy
Top achievements
Rank 2
answered on 04 Mar 2013, 04:08 AM
Hi Darin,

Please take a look into the following code I tried to update a RadGrid using a RadWindow. I have used an asp:DetailView as the Editform for the Parent radgrid. I have used a Javascript function which can be invoked in the ItemCommand event of the DetailView in order to refresh the RadGrid as in this Demo.

JavaScript:
<script type="text/javascript">
    function CloseAndRebind(args) {
        GetRadWindow().BrowserWindow.refreshGrid(args);
        GetRadWindow().close();
    }
  
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
</script>

C#:
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
    if (e.CommandName == "Update")
    {
        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
    }
}

Thanks,
Princy.
Tags
Ajax
Asked by
Darin
Top achievements
Rank 1
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or