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;
}
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;
}