window.open(...)

G

Guest

I have a main web form, "main.aspx" with one login-button. I'd like to open a 2nd form "frm_activity.aspx" in a separate browser window using a client-script upon clicking the login-button from main form

Some Code from "main.aspx.vb"..
Private Sub btn_Login_Click(...
if Not IsClientScriptBlockRegistererd( "OpenW" ) the
Dim DQ As Char = Char(34
Dim scriptString As String = "<script language=JavaScript>
scriptString &= "window.open(" & DQ & "frm_activity.aspx" & D
scriptString &= "," & DQ & "_blank" & DQ & ");
scriptString &= "</script>
RegisterClientScriptBlock( "OpenW", scriptString
end i
End Su

Question1: The 2nd browser window is opened - but is not the focus window. The focus remains with the main form. What must I do to ensure the focus is on the 2nd browser window, i.e., "frm_activity.aspx"
Question2: If I wanted to dispose of the first browser window - once the 2nd browser window is opened, how would I do this?
 
V

vMike

Try something like this.

"win1=window.open(...);win1.focus();return true;"
David said:
I have a main web form, "main.aspx" with one login-button. I'd like to
open a 2nd form "frm_activity.aspx" in a separate browser window using a
client-script upon clicking the login-button from main form.
Some Code from "main.aspx.vb"...
Private Sub btn_Login_Click(...)
if Not IsClientScriptBlockRegistererd( "OpenW" ) then
Dim DQ As Char = Char(34)
Dim scriptString As String = "<script language=JavaScript>"
scriptString &= "window.open(" & DQ & "frm_activity.aspx" & DQ
scriptString &= "," & DQ & "_blank" & DQ & ");"
scriptString &= "</script>"
RegisterClientScriptBlock( "OpenW", scriptString )
end if
End Sub

Question1: The 2nd browser window is opened - but is not the focus window.
The focus remains with the main form. What must I do to ensure the focus is
on the 2nd browser window, i.e., "frm_activity.aspx"?
Question2: If I wanted to dispose of the first browser window - once the
2nd browser window is opened, how would I do this?
 
G

Guest

Thanks

Any ideas about the other question. Once I have the 2nd browser open and with focus, how can I close the first browser window - I'd like to be able to close the first window but not be prompted (I can append window.close(); but this prompts me). Is there anyway to get the handle of the first window and use SendMessage and pass the handle to close this window in ASP.NET?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top