472,147 Members | 1,254 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,147 software developers and data experts.

Opening Multiple Windows

I am using the window.open function to open a small window and I am
using GET to get values back from that window. I want to be able to open
another from the second window but I get an error message when I try to
do another window.open. Any suggestions are welcomed.

Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
7 3054
Hi Evan,

Did you mean to open a ie window in javascript or vbscript?
If so, how can you use the GET method to get values from an ie window in
client?
Can you post some code? So that I can narrow down the problem more quickly.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: Opening Multiple Windows
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <#p**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
Date: Tue, 02 Sep 2003 15:05:16 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107010
X-Tomcat-NG: microsoft.public.dotnet.general

I am using the window.open function to open a small window and I am
using GET to get values back from that window. I want to be able to open
another from the second window but I get an error message when I try to
do another window.open. Any suggestions are welcomed.

Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #2

Here is the code from the button click from the first form to open the
second form.

Private Sub BTNSlctMvFrm_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BTNSlctMvFrm.Click

Dim str As String = "<script language
=javascript>{window.open('userselectionform.aspx?f ormname1=Form1.TBXMvFr
mRm&formname2=Form1.TBXMvFrmFlr&formname3=Form1.TB XMvFrmBldg&formname4=F
orm1.TBXMvFrmSt&formname5=Form1.TBXMvFrmLNm&formna me6=Form1.TBXMvFrmFNm'
,"

str += " 'UserSelection','menubar=no,resizable=no,
toolbar=no,scrollbars=no,top=100,left=300,height=4 00,width=300');}</scri
pt>"

RegisterStartupScript("adf", str)

End Sub
Here is the code from the button click on the second form to close it
and post the info back to fields on the first.

Private Sub BtnCnfmMv_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnCnfmMv.Click

Try
Dim Str As String = "<script language=""javascript"">"

Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname1 ") & ".value = '" &
DDLRm.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname2 ") & ".value = '" &
DDLFlr.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname3 ") & ".value = '" &
DDLBldg.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname4 ") & ".value = '" &
DDLSite.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname5 ") & ".value = '" &
Trim(DDLMvNm.SelectedValue.Substring(0,
DDLMvNm.SelectedValue.IndexOf(","))) & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname6 ") & ".value = '" &
Trim(DDLMvNm.SelectedValue.Substring(DDLMvNm.Selec tedValue.IndexOf(",")
+ 2)) & "';window.close();"
Str = Str & "</script>"
LiteralRm.Text = Str
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub

I want to be able to open ANOTHER window from the second window, if
nothing more than to place a graphic box on it and show a graphic. Help
please.
Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
Hi Evan,

I can not reproduce the problem. But I have written a demo as below.
[WebForm1.aspx.vb, add a button and textbox onto the WebForm1.aspx]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim str As String = "<script language
=javascript>{window.opener.Form1.TextBox1.value
='hello';window.close();window.open('http://www.google.com');}</script>"
RegisterStartupScript("a", str)

End Sub
[WebForm2.aspx.vb add a button onto the WebForm2.aspx]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim str As String = "<script language
=javascript>{window.open('http://localhost/WebApplication4/WebForm2.aspx');}
</script>"
RegisterStartupScript("adf", Str)
End Sub

You may have a test and let me know if it does the job for you.
Did I misunderstand your meaning?
If you have any related question please feel free to let me know.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
References: <Jq**************@cpmsftngxa06.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: RE: Opening Multiple Windows
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <e6**************@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
Date: Wed, 03 Sep 2003 05:45:34 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107075
X-Tomcat-NG: microsoft.public.dotnet.general
Here is the code from the button click from the first form to open the
second form.

Private Sub BTNSlctMvFrm_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BTNSlctMvFrm.Click

Dim str As String = "<script language
=javascript>{window.open('userselectionform.aspx? formname1=Form1.TBXMvFr
mRm&formname2=Form1.TBXMvFrmFlr&formname3=Form1.T BXMvFrmBldg&formname4=F
orm1.TBXMvFrmSt&formname5=Form1.TBXMvFrmLNm&formn ame6=Form1.TBXMvFrmFNm'
,"

str += " 'UserSelection','menubar=no,resizable=no,
toolbar=no,scrollbars=no,top=100,left=300,height= 400,width=300');}</scri
pt>"

RegisterStartupScript("adf", str)

End Sub
Here is the code from the button click on the second form to close it
and post the info back to fields on the first.

Private Sub BtnCnfmMv_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnCnfmMv.Click

Try
Dim Str As String = "<script language=""javascript"">"

Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname 1") & ".value = '" &
DDLRm.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname 2") & ".value = '" &
DDLFlr.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname 3") & ".value = '" &
DDLBldg.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname 4") & ".value = '" &
DDLSite.SelectedValue & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname 5") & ".value = '" &
Trim(DDLMvNm.SelectedValue.Substring(0,
DDLMvNm.SelectedValue.IndexOf(","))) & "';"
Str = Str & "window.opener." &
HttpContext.Current.Request.QueryString("formname 6") & ".value = '" &
Trim(DDLMvNm.SelectedValue.Substring(DDLMvNm.Sele ctedValue.IndexOf(",")
+ 2)) & "';window.close();"
Str = Str & "</script>"
LiteralRm.Text = Str
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub

I want to be able to open ANOTHER window from the second window, if
nothing more than to place a graphic box on it and show a graphic. Help
please.
Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #4
Peter,

Let's make this simple. I want to be able to window.open from one form
to another and then window.open from the second web form to a third. I
want to then be able to close the third form and pass data from the
second form back to the first.
Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5
Hi Evan,

Provided there are three forms, A, B and C, each one have textbox and a
button on it.(ButtonA TextBoxA on form A,ButtonB TextBoxB on form B,ButtonC
TextBoxC on form C)

Click ButtonA will open form B, click ButtonB will open formC, input some
text into textBoxC and click the ButtonC will put back the text into
textBoxB and close form C.
click ButtonB will put back the text in TextBoxB into TextBoxA and close
FormB.

or

Provided there are three forms, A, B and C, ButtonA TextBoxA on form
A,ButtonB1 ButtonB2 TextBoxB on form B, TextBoxC on form C)

Click ButtonA will open form B, click ButtonB1 will open formC, input some
text into textBoxC and click the ButtonB2 will put back the text in
TextBoxC into textBoxB and close form C.
click ButtonB will put back the text in TextBoxB into TextBoxA and close
FormB.

Did I misunderstand your meaning?

If you are the latter case, when you use the window.open, the method will
return a reference to the new opened window which can be used to control
the new opened window.

string str = "<script language
=javascript>{window.opener.Form1.TextBox1.value ='hello';var o =
window.open('http://www.google.com');o.close();}</script>";
RegisterStartupScript("a", str);

the o in the code above is the reference to the new opened form. you may
used the reference to close the new opened one.

If you have any related question, please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
References: <5F**************@cpmsftngxa06.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: RE: Opening Multiple Windows
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <#6**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
Date: Thu, 04 Sep 2003 08:13:52 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!tk2msftngp13.phx.gblXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107285
X-Tomcat-NG: microsoft.public.dotnet.general

Peter,

Let's make this simple. I want to be able to window.open from one form
to another and then window.open from the second web form to a third. I
want to then be able to close the third form and pass data from the
second form back to the first.
Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #6
Peter,
Using the ABC's of forms, here goes. Form A has a textbox and button
to open form B. Form B has a textbox and button to open form c. Form C
has a graphic box and button to close the form and go back to form B.
Click on the button on form A to open form b. Select some data on form
b. Click on the button to open Form C and display a graphic w/the data
from Form B. Close Form B then close Form B passing the same data back
to the textbox on Form A. Is that clear?
Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #7
Hi Evan,
from Form B. Close Form B then close Form B passing the same data back
to the textbox on Form A.
From the post, I do not know when you want to close the FormB,Since there
is only one button on the Formb and it is used to open FormC, so I think
perhaps you want to close the Form B and Form C after you have click the
button on FormC.
Anyway, if you want to pass the data to new opened window, you may use the
GET method to pass it in the QueryString HTTP server variable.
Here is my code. I assume that I have a textbox and a button on each Form.

[WebForm1.aspx.vb]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim str As String = "<script language
=javascript>{window.open('http://localhost/WebApplication4/WebForm2.aspx');}
</script>"
RegisterStartupScript("adf", Str)
End Sub

[WebForm2.aspx.vb]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim str As String = "<script language
=javascript>{window.open('http://localhost/WebApplication4/WebForm3.aspx?con
tent=" & TextBox1.Text & "');}</script>"
RegisterStartupScript("a", str)
End Sub

[WebForm3.aspx.vb]
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = Request.QueryString("content")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim str As String = "<script language
=javascript>{window.opener.opener.Form1.TextBox1.v alue ='" & TextBox1.Text
& "';window.close();window.opener.close();}</script>"
RegisterStartupScript("a", str)
End Sub
Did I misunderstand your question? If you have any related quesiton please
feel free to let me know.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------From: Evan Kontos <ek*****@comtekcadd.com>
References: <Mq*************@cpmsftngxa06.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: RE: Opening Multiple Windows
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <#E**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
Date: Fri, 05 Sep 2003 18:13:03 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107493
X-Tomcat-NG: microsoft.public.dotnet.general

Peter,
Using the ABC's of forms, here goes. Form A has a textbox and button
to open form B. Form B has a textbox and button to open form c. Form C
has a graphic box and button to close the form and go back to form B.
Click on the button on form A to open form b. Select some data on form
b. Click on the button to open Form C and display a graphic w/the data
from Form B. Close Form B then close Form B passing the same data back
to the textbox on Form A. Is that clear?
Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by SD Keane | last post: by
14 posts views Thread by D. Alvarado | last post: by
4 posts views Thread by Niranjan | last post: by
1 post views Thread by Alasdair | last post: by
2 posts views Thread by Matt Hamilton | last post: by
11 posts views Thread by Evan Kontos | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.