problem with window.opener when close a radwindow

3 posts, 0 answers
  1. piro
    piro avatar
    6 posts
    Member since:
    Mar 2008

    Posted 23 Apr 2009 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Apr 2009 Link to this post

    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.
  3. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 24 Apr 2009 Link to this post

    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.
Back to Top