Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup window hides behind opener window (VS 2005)

Status
Not open for further replies.

sbushway

Programmer
Jan 27, 2003
58
US
I have a web app that contains a button which brings up a popup window when clicked. It worked just fine in ASP.NET 1.0 (using Studio 2003). But now that I converted my project over to ASP.NET 2.0 (using Studio 2005), my popup window appears, but then immediately hides behind the opener window.

The only way I've found to get around this problem is to put "onload=self.focus()" in the BODY tag of the popup
window - and even then, if I look closely, I can see the popup window appear, immediately go behind the opener window, and then appear again when the 'onload' gets called.

Here's my code ...

Code:
Dim popUp as String = "myurl.aspx"
Dim script as String = ""
script += "<script language='Javascript' id='PrevOrders'>"
script += "var confirmWin = null;"
script += "var screenX = window.screen.availWidth/2 - 400;"
script += "var screenY = window.screen.height/2 - 300;"
script += "confirmWin = window.open('" + popUp + "', 'PrevOrders', 'width=550, height=150, left=' + screenX + ', top=' + screenY + ',status, scrollbars=no, menubar=yes');"
script += "if((confirmWin != null) && (confirmWin.opener==null)) {"
script += " confirmWin.opener = self;"
script += "}"
script += "</script>"

If ClientScript.IsStartupScriptRegistered("popUp") = False Then
  ClientScript.RegisterStartupScript(Me.GetType, "test", script)
End If

Can someone help me figure out why my popup window keeps hiding behind the opener window?

TIA,
Suzanne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top