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

Returning values to parent page from rad window.

4 Answers 834 Views
Window
This is a migrated thread and some comments may be shown as answers.
Praveen Addepally
Top achievements
Rank 1
Praveen Addepally asked on 05 Oct 2009, 06:08 PM

Hello all,
               I have a common scenario, but i could not implement in a cleaner way.
 
I have web page which contains a treeview and 2 grid.On clicking each node in tree view shows two grids on right hand side of the treeview populated with values related to the clicked node in treeview. Now on right clicking the node in tree view and selecting a context menu item will open a new rad window for me.

In the rad window the user will make update/insert/delete operations against database. The user can close this rad window in two ways - one is clicking the 'close' button in rad window
-second is clicking the 'X' button on top right corner of rad window.

what i need to do is 'onclientclose' of radwindow, i need to read the arguments that are passed from radwindow and depending on those passed arguments, i have to refresh the treeview as well as the two grids on the parent page. I'm able to achieve this when user clicks 'close' button on radwindow, but when user clicks the 'X' i cannot get the arguments passed back from rad window to parent page. Could anybody please help me in this case?

when user clicks close button on rad window, this is how i'm closing rad window and passing back arguments

 

 

var oArg = new Object();

 

oArg.ReloadGrids = true;

 

oArg.ReloadTreeView= false;
RadWindow.close(oArg);

and on client close this is how i read arguments passed from rad window

 

function

 

 RadWindow_OnClientClose(oRadWind, args) {

 

 

//get the transfered arguments

 

 

var arg = args.get_argument();

 

}


Please let me know if you guys need some more info..

 

cheers!

pravin.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Oct 2009, 01:34 PM
Hi Praveen,

I tried another approach for passing the parameter to parent window. I tried getting reference to window and set the argument for window object. For each change for the value update the argument value. And in the OnClientClose event, retrieve the argument as shown below.

window.aspx:
 
<script type="text/javascript"
    var oWnd; 
    function pageLoad() { 
        oWnd = GetRadWindow(); 
    } 
    function change() { 
        oWnd.argument = "Value"// Update the value 
    } 
    function returnArg() { 
        oWnd.argument = "Hi"// Set the updated value in button click
        oWnd.close(); 
    } 
    function GetRadWindow() { 
        var oWindow = null
        if (window.radWindow) 
            oWindow = window.radWindow; 
        else if (window.frameElement.radWindow) 
            oWindow = window.frameElement.radWindow; 
        return oWindow; 
    }   
</script> 

parent.aspx:
 
<script type="text/javascript"
    function clientClose(oWnd) { 
        var arg = oWnd.argument; 
        alert(arg); 
   } 
</script> 

-Shinu.
0
Praveen Addepally
Top achievements
Rank 1
answered on 06 Oct 2009, 04:00 PM
Hello shinu,
                   I have tried your soln. and it works for me!But instead of calling change() function each time value got changed, do you know a way to call change 'change()' function onclick of 'X' button which is on top right corner of rad window?

Cheers!
Pravin.
0
Pravin Kamane
Top achievements
Rank 1
answered on 21 May 2010, 07:40 AM
Hi, all,
Thanks for the wonderful sollutions you provide.

Related to the passing values to the parent Page, I have a querry.

I am using a Radwindow to host an aspx page, in which the User control is loaded.
I am able to get the popup properlly, but my problem starts after that.
Iam passing the parameters back using 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

function CloseWithArg()

{

        var customArg =  "1,2,3,4,5,6,7,8,9,10";

 

 

        GetRadWindow().close(customArg);

}
function GetRadWindow()
{

 

 

      var oWindow = null;

 

 

 

        if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog

 

 

 

           else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)

 

 

 

 

      return oWindow;

 

 

}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 


This usercontrol is hosted in an aspx page, which is hosted using the radwindow. Iam utilising the onclientclose event of the radwindow, but my event is not called. Handling the below function for the event OnClientclose

function OnClientclose(sender, eventArgs)
 {

 

 

        var arg = eventArgs.get_argument();

 

 

        if (arg) {

 

 

 

                       alert(arg);

 

 

                     }

 

        else {

 

 

                 alert("No Parameters Passed');

 

 

                 }

}

 

Do i have to take special care as iam not passing parameters from the aspx page directly, rather from the ascx page.

Thanks & Regards,
Pravin.S.Kamane

0
Fiko
Telerik team
answered on 26 May 2010, 10:26 AM
Hi Pravin,

The provided information is not enough for me to determine the exact reason for the behavior that you experience. Could you please open a new support ticket and send me a project which shows your setup. I will check it and do my best to provide a solution as soon as possible.

All the best,
Fiko
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Window
Asked by
Praveen Addepally
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Praveen Addepally
Top achievements
Rank 1
Pravin Kamane
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or