In asp.net application, new windows can be opened using window.open method either from the client side or from executing it from server side. See the list of parameters it takes http://msdn.microsoft.com/en-us/library/ms536651(v=vs.85).aspx
The problem most of the developers face with this, is that the new window does not popup in front of the opener window.
There are solutions for this, like;
- Setting the focus to the opened winow
var NewWin = window.open('somepage.aspx, 'myWin', 'toolbar=no, status=yes, menubar=no, resizable=no, scrollbars=yes, width=670, height=800');
NewWin.focus();
- Or in the load of new winodw's page (like in the header tag)
<head runat="server">
<script type="text/javascript">
window.focus();
</script>
<title>Untitled Page</title>
</head>
But most of the times these solutions fail, there are timing issues like the opened page comes back from the server and is shown again or there are still more events to happen on the opener page so even after the new window is shown, the opener page may come in front of you after the whole excution.
To bring the new page on the front and to encounter these type of issues, setting a time out on the script of focusing the new page will work.
You can set the time out (say 60 mili-seconds) to a method which will set the focus to the new opened window after it is opened. This way it can be made to appear on the front after all the processing on the opener page.
Use this script for opening the new window and bringing it on the front ;
var NewWin = window.open('somepage.aspx, 'NewWindow', 'toolbar=no, status=no, menubar=no, resizable=no, scrollbars=yes, width=670, height=800');
NewWin.focus();
setTimeout('ExecFocus()', 60);
function ExecFocus() {
NewWin.focus();
}
See parameters and examples of setTimeout method here: http://msdn.microsoft.com/en-us/library/ms536753(v=vs.85).aspx