2

I am trying to rebind my grid once a radwindow has been closed through master page. My grid is in a usercontrol in aspx page. In master page i have :

 function CancelEdit() {
            GetRadWindow().Close();
        }

        function CloseAndRebind() {
            GetRadWindow().BrowserWindow.refreshGrid(); // Call the function in parent page 
            GetRadWindow().close(); // Close the window 
        }

        function refreshGrid() {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }

and I have the following javascript in the user conrtrol:

<script type="text/javascript" language="javascript">
    function refreshGrid() {
        $find("<%= RadAjaxManager.GetCurrent(me.Page).ClientID %>").ajaxRequest("Rebind");
    }

</script>

Once I close update the database in radwindow i register a javascript:

 ScriptManager.RegisterStartupScript(Page, Page.GetType(), "mykey", "CloseAndRebind();", True)

I can see my data source changing but the grid doesn't get updated. any suggestions?

EDIT ::

The structure is something like this:

I have master page which has the RadAjaxManager.
There is a main page which has a user control
Another user control inside above user control which has the RadGrid
Then there is an aspx page that opens as radwindow
Zaki
  • 5,540
  • 7
  • 54
  • 91

1 Answers1

1

Use the client-side API to rebind your grid, should be the correct way to do that:

In your child page:

    function refreshGrid() {
        $find("<%= YourGrid.ClientID %>").get_masterTableView().rebind();
    }

To call a javascript function from the parent page, simply use this:

    function CloseAndRebind() {
        GetRadWindow().get_contentFrame().contentWindow.refreshGrid(); // Call the function in parent page 
        GetRadWindow().close(); // Close the window 
    }
Francis P
  • 13,377
  • 3
  • 27
  • 51
  • changed user control's refreshgrid to this and still dont refresh – Zaki Jan 11 '13 at 17:02
  • if the javascript is reached, then try using a RadAjaxManager to refresh the control. – Francis P Jan 11 '13 at 17:08
  • I can see the refreshGrid() on master page being called but not on user control.. – Zaki Jan 11 '13 at 17:41
  • See the edited answer, you don't need a `refreshGrid` function in the parent page, only in the child page, which can then be accessed from the `GetRadWindow()` function. – Francis P Jan 11 '13 at 17:55