This is a migrated thread and some comments may be shown as answers.
problem with window.opener when close a radwindow
2 Answers 52 Views
This is a migrated thread and some comments may be shown as answers.
piro
Top achievements
Rank 1
piro asked on 23 Apr 2009, 10:13 AM
When I call a javascript to close a radwindow by itseft and want to call a function wrote from parent page  , there was an error.
My code block :

var oWindow = null;
 if (window.radWindow)
     oWindow = window.radWindow;
 else
 if (window.frameElement.radWindow)
     oWindow = window.frameElement.radWindow;
     oWindow.close();
if(!window.opener.closed) window.opener.assignTask();

When I run this script there was an error  that : window.opener.closed is null
I was try without using radWindow . There was no error. How can't I fix this problem ?
I wan't to ask more that, is there a  way to call a button from a page that is opening ?
Thanks  very much



 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 24 Apr 2009, 06:00 AM
Hi Piro,

Attach the event handler to OnClientClose of RadWindow which is called after the window is closed.

[aspx]
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" VisibleOnPageLoad="true" DestroyOnClose="true" Skin="Telerik" OnClientClose="OnClientClose"
</telerik:RadWindowManager> 

[javascript]
 
<script type="text/javascript"
function OnClientClose() 
    //Your code here 
</script> 

It is possible to get the OpenerElementID value by using the method oWindow.get_openerElementID() from dialog page. Also you can use the current RadWindow to get a reference to the parent page as shown below.
[javascript]
 
<script type="text/javascript"
function GetRadWindow() 
  var oWindow = null
  if (window.radWindow) 
     oWindow = window.radWindow; 
  else if (window.frameElement.radWindow) 
     oWindow = window.frameElement.radWindow; 
  return oWindow; 
function getParent() 
  var oBrowserWnd = GetRadWindow().BrowserWindow; 
</script> 
Go through the following link for more information.
Opening a RadWindow from Within a RadWindow




Thanks,
Shinu.
0
Fiko
Telerik team
answered on 24 Apr 2009, 06:50 AM
Hello Piro,

For your convenience I prepared a simple demo and attached it to this thread.

I hope this helps.

Greetings,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Asked by
piro
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or