Wednesday, 19 March 2014

Refresh Parent Page and closing the Rad window using Customize Url

We may have scenarios like closing the rad window where the rad window will call different page and refresh the parent page with customized url after task is finished in rad window
In that case

First Add the following java script to the page where Rad window is navigated

 <script type="text/javascript">
        // Get Rad Window
        function getRadWindow() {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.radWindow;
            else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow;
            return oWindow;
        }

        // Redirect page to url
        function redirectParentPage(url) {
            getRadWindow().BrowserWindow.document.location.href = url;
        }
    </script>

Next in that page code behind file  Add the following logic to respect event handler

//Customized Url
 string url = "";
 Page.ClientScript.RegisterClientScriptBlock(GetType(), "CloseScript", "redirectParentPage('" + url + "')", true);

This is will redirect to the parent page and refresh it.

No comments:

Post a Comment