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

RadWindow issue while closing

1 Answer 53 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mario
Top achievements
Rank 1
Mario asked on 28 Jun 2013, 08:31 AM
On click of a RadMenu item we are opening a RadWindow using below code. This RadWindow loads a ASPX page which has a "Ok" button. On click of this "OK" button a javascript function (mentioned below - CreateParentPage) is called which first create a URL based on some user selection and then open a browser and lastly close the existing RadWindow on which we clicked "ok".
The issue is that when CreateParentPage function is called on click of "OK", the new browser which gets opened using window.open is immediately sent to background. We found that this code GetRadWindow().Close() is triggering this behavior. If we comment the code of closing the RadWindow, the browser does not go in background. 
We have also noted a weird point that if we open the RadWindow from a sub-menu item of RadMenu then this issue is not occurring.

Code used to open RadWindow:
 function ShowCreatePopup() {
                var manager = $telerik.findControl(document, "<%=RadWindowManager1.ClientID%>");
                var oWnd = manager.GetWindowByName("RadWindow1");
                oWnd.SetUrl('/_layouts/Test.Web.UI.SharePoint/CreatePopup.aspx');
                oWnd.Show();
            }

Code used to open a page based on the URL created and then close the Radwindow:
function CreateParentPage() {
   var reqUrl =      // Here make some URL string  
    window.open(reqUrl , "_blank", "width=1050px,height=700px,resizable=yes,scrollbars=yes,toolbars=no,menubar=no,location=no");
    GetRadWindow().Close();
  }

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

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 28 Jun 2013, 10:58 AM
Hi Mario,

I am not aware of such a problem and when I tried the setup (attached is my sample) things worked fine with me in IE, Chrome and Firefox (all the major browsers I tested) - the browser popup remained foremost. This was the behavior from the button, from the first level menu items and from the second level menu items as well.

What I can suggest is adding a timeout around the call to window.open() OR around GetRadWindow().close() and see if this helps. Even 0ms could be enough to let the browser recalculate the active window and lead to the behavior you desire.


Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Window
Asked by
Mario
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or