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

open a regular browser window from a RadWindow and make it active

5 Answers 182 Views
Window
This is a migrated thread and some comments may be shown as answers.
john81
Top achievements
Rank 1
john81 asked on 08 Jun 2010, 02:17 PM
I have a web page that is a list of reports.  I use a RadWindow to get the user to enter parameters for the report.  Is it possible to get the RadWindow to open a new browser window that is active?  I'm using the javascript below which opens the report in a new window but it ends up behind my report selection window.

function returnToParent() 
    window.open(report + paras, """height=740,scrollbars=yes,width=1000,status=yes,toolbar=yes,menubar=yes,resizable=yes"); 
    self.close(); 


I think what's happening is the RadWindow opens the new browser window then closes and the focus reverts back to the parent window.  End result is the new browser window opened for the report is behind my report selection window.  I'd live to have the new window appear on top as the active window.  Any ideas?

5 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 14 Jun 2010, 08:48 AM
Hello John,

I am not quite sure that I understood your scenario. Could you please rework my test project (I have used RadWindow's close method instead of the self.close()) in order to replicate the behavior that you experience, open a new support ticket and send it back? I will check it and do my best to provide a solution as soon as possible.

All the best,
Fiko
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
bdrennen
Top achievements
Rank 1
answered on 11 Jul 2012, 04:36 PM
I'm looking for an answer to the same question. I have a web page that opens a RadWindow. The user makes various selections in the RadWindow (it's a form), and clicking a button in the form opens a new browser window and closes the RadWindow.

However, when the RadWindow closes, the newly opened browser window gets pushed to the background. I'd like it to remain in front.

Is there a way to close the RadWindow that doesn't cause the newly opened window to lose focus?

This is the JavaScript I'm using in the page displayed inside the RadWindow to open the new window and close the RadWindow.
formWindow = window.open(URL, "_blank", "directories=0,location=0,menubar=0,status=0,toolbar=0,resizable=1,scrollbars=1");
 
var oWindow = null;
if (window.radWindow)
  oWindow = window.radWindow;
else if (window.frameElement.radWindow)
  oWindow = window.frameElement.radWindow;
oWindow.close();


Thank you,

Bryan
0
bdrennen
Top achievements
Rank 1
answered on 12 Jul 2012, 04:30 PM

When I originally looked at the sample project, I just compared the JavaScript with my own project and didn't see any marked differences. I finally played with it a bit this morning and found that the sample project behaved properly, so I took a closer look. It turns out I'm having focus issues because I'm declaring and using a RadWindow, while the example doesn't. If I take out my RadWindow references from my radOpen call, I don't have issues with the new window appearing in the background. I modified the sample project and it started behaving the same way my current project does.

I changed the sample code from:


<
telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>

to this:


<
telerik:RadWindowManager ID="RadWindowManager1" runat="server">
<Windows>
<telerik:RadWindow ID="RadWindow1" runat="server" Width="650" Height="480" Modal="true" VisibleStatusbar="false" VisibleTitlebar = "true" Behaviors="Close, Move"> </telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>

I changed the JavaScript from this:

function openRadWindow() { radopen("Popup.aspx"null).moveTo(0, 0); }

To this:

function
 openRadWindow() { radopen("Popup.aspx""RadWindow1").moveTo(0, 0); }

And now it behaves the same way my page does. Any ideas on how to fix this?

I've found that setting Modal = "false" results in the new window opening in the foreground. I'd prefer not to do this, but if this is the only solution, I can live with that.

Thanks,

Bryan

0
Svetlina Anati
Telerik team
answered on 16 Jul 2012, 03:55 PM
Hi Bryan,

 I suggest to try the following:

1) Close the RadWindow first
2) Open the new window with timeout of 0

Both the activities above should not give a visual difference but should change the focus. You should modify your code in manner similar to:

var oWindow = null;
  
if (window.radWindow)
 
  oWindow = window.radWindow;
  
else if (window.frameElement.radWindow)
 
  oWindow = window.frameElement.radWindow;
  
oWindow.close();
 
 
setTimeout(function(){
formWindow = window.open(URL, "_blank", "directories=0,location=0,menubar=0,status=0,toolbar=0,resizable=1,scrollbars=1");
}, 0);

Please, test my suggestion and let me know how it goes.

Kind regards,
Svetlina Anati
the Telerik team
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 their blog feed now.
0
bdrennen
Top achievements
Rank 1
answered on 16 Jul 2012, 04:10 PM
Svetlina:

Ah, excellent! Yes, that works. However, I changed the timeout from 0 to 10 because the new window opened behind the parent window intermittently with a timeout of 0. It works everytime with a timeout of 10, though.

Thank you very much for your help!

Bryan
Tags
Window
Asked by
john81
Top achievements
Rank 1
Answers by
Fiko
Telerik team
bdrennen
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or