Thursday, March 22, 2012

Open a new window on top of parent window using script

Using .NET 1.1, vb code behind.
I have a project and I have been opening new windows throughout it. I
need them opened on top of the parent, and be able to minimize or go
back to the parent if needed before closing the new window. I am
opening the window this way.
Response.Write("<script>window.open('ReviewComments.aspx')</script>")

On the code behind of the new window in the Page_Load function, I keep
the window on top by using this.
RegisterStartupScript("OpenOnTop", "<script
language=javascript>document.focus();</script>")

This has worked great for about 5 other windows. I have went back and
added another window, but it doesn't work everytime. I can sit here
and test it over and over, and sometimes it stays on top but most of
the time it goes to the back. I have checked the properties of the
page against the ones that work and they are identical. Any ideas what
is happening?
I am open to other ways of getting the window to stay on top, so
suggestions are appreciated.
Thxmost likey, the other windw is setting focus. you should stop using popups
as most browsrs will block them. use a floating iframe instead. a good
javscript book will tell you how, so get a control.

-- bruce (sqlwork.com)

"Ralf" <marty.overdear@.intergraph.comwrote in message
news:1163625630.873697.179910@.e3g2000cwe.googlegro ups.com...

Quote:

Originally Posted by

Using .NET 1.1, vb code behind.
I have a project and I have been opening new windows throughout it. I
need them opened on top of the parent, and be able to minimize or go
back to the parent if needed before closing the new window. I am
opening the window this way.
Response.Write("<script>window.open('ReviewComments.aspx')</script>")
>
On the code behind of the new window in the Page_Load function, I keep
the window on top by using this.
RegisterStartupScript("OpenOnTop", "<script
language=javascript>document.focus();</script>")
>
This has worked great for about 5 other windows. I have went back and
added another window, but it doesn't work everytime. I can sit here
and test it over and over, and sometimes it stays on top but most of
the time it goes to the back. I have checked the properties of the
page against the ones that work and they are identical. Any ideas what
is happening?
I am open to other ways of getting the window to stay on top, so
suggestions are appreciated.
Thx
>


On the one parent page, I have a datagrid that has 2 buttons. Each
button opens a seperate window. The one button works great everytime,
this button works about 1 out of 10 times. I don't think the parent is
gaining focus b/c it would be doing so with the other window.

0 comments:

Post a Comment