Question

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
Was it helpful?

Solution

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 
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top