RadWindow issue while closing

2 posts, 0 answers
  1. Mario
    Mario avatar
    2 posts
    Member since:
    May 2011

    Posted 28 Jun 2013 Link to this post

    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;
                }
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 28 Jun 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top