Pages

Feb 20, 2013

How to pass argument from Rad popup window to parent window

Below is an example that demonstrates how to pass an argument from the rad pop window to parent window and based on the argument we should refresh the page.

On the pop up window call the pageload method like

<body onload="pageload();">

and call the close popup method from button click.

then use the script as below
var oWnd;
        function closePopup(URL) {

            oWnd.argument = "Refresh"; // Set the updated value in button click
            oWnd.close();
                }
       
        function pageLoad() {
            oWnd = GetRadWindow();
        }
                

        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.radWindow;
            else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow;
            return oWindow;
        }  


On the parent window onclientclose method get the argument and based on the argument i am reloading the page.

          function OnClientClose(oWnd) {
              var arg = oWnd.argument;
              
            oWnd.setUrl("about:blank"); // Sets url to blank
              oWnd.remove_close(OnClientClose);
              if(arg.toString() == 'Refresh')
                window.location.reload();
               //remove the close handler - it will be set again on the next opening
          }