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

How to rebind more three RadGrid after close the RadWindow

1 Answer 92 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Manish asked on 01 Nov 2013, 10:59 AM

I am getting problem in rebind radgrid on radwindow close because i have to rebind 3 grid on parent page. It is rebinding just last grid which i have mentioned in code.
Following code i have used in my code

///------ In radwindow javascript code -------
 function clientClose(arg) {
                var oWin = getRadWindow();
                var parentWindow = oWin.BrowserWindow;
                // top.location.href = top.location.href;

/// ---------In parent page javascirpt code -----
        function refreshGrid() {
                var masterTable1 = $find("<%=rgDefinition.ClientID%>").get_masterTableView();
                var masterTable2 = $find("<%=rgDevelopment.ClientID%>").get_masterTableView();
                  var masterTable3 = $find("<%=rgTesting.ClientID%>").get_masterTableView();
Problem is that ----   this code rebinding my last grid means masterTable3.rebind(); because it is in the last of code.

1 Answer, 1 is accepted

Sort by
Konstantin Dikov
Telerik team
answered on 04 Nov 2013, 12:59 PM
Hello Manish,

The functionality you want could not be achieved entirely on client-side. 

One possible solution for your requirement could be to fire a custom command through one of the grids and in the code-behind to rebind the three grids.

Here is how you could fire command from a grid:
<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
    <script type="text/javascript">
        function rebindGrids(sender, args) {
            var grid = $find("<%=RadGrid1.ClientID%>");
            grid.get_masterTableView().fireCommand("rebindGrids", "");
<telerik:RadWindow ID="RadWindow1" runat="server" VisibleOnPageLoad="true" OnClientClose="rebindGrids"></telerik:RadWindow>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
    <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand"></telerik:RadGrid>
    <telerik:RadGrid ID="RadGrid2" runat="server" OnNeedDataSource="RadGrid2_NeedDataSource"></telerik:RadGrid>
    <telerik:RadGrid ID="RadGrid3" runat="server" OnNeedDataSource="RadGrid3_NeedDataSource"></telerik:RadGrid>

And the code-behind for handling the custom command:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    if (e.CommandName == "rebindGrids")

Attached you could find a sample page with the above functionality.

Hope that helps.


Konstantin Dikov
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 the blog feed now.
Asked by
Top achievements
Rank 2
Answers by
Konstantin Dikov
Telerik team
Share this question