Opening Multiple Windows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Evan Kontos

    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 | EKontos@comtekc add.com

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


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Peter Huang [MSFT]

    #2
    RE: Opening Multiple Windows

    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.
    --------------------[color=blue]
    >From: Evan Kontos <ekontos@comtek cadd.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: <#podL5ZcDHA.25 72@TK2MSFTNGP12 .phx.gbl>
    >Newsgroups: microsoft.publi c.dotnet.genera l
    >Date: Tue, 02 Sep 2003 15:05:16 -0700
    >NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
    >Lines: 1
    >Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
    >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:107010
    >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    >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 | EKontos@comtekc add.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!
    >[/color]

    Comment

    • Evan Kontos

      #3
      RE: Opening Multiple Windows


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

      Private Sub BTNSlctMvFrm_Cl ick(ByVal sender As System.Object, ByVal e As
      System.EventArg s) Handles BTNSlctMvFrm.Cl ick

      Dim str As String = "<script language
      =javascript>{wi ndow.open('user selectionform.a spx?formname1=F orm1.TBXMvFr
      mRm&formname2=F orm1.TBXMvFrmFl r&formname3=For m1.TBXMvFrmBldg &formname4=F
      orm1.TBXMvFrmSt &formname5=Form 1.TBXMvFrmLNm&f ormname6=Form1. TBXMvFrmFNm'
      ,"

      str += " 'UserSelection' ,'menubar=no,re sizable=no,
      toolbar=no,scro llbars=no,top=1 00,left=300,hei ght=400,width=3 00');}</scri
      pt>"

      RegisterStartup Script("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.EventArg s) Handles BtnCnfmMv.Click

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

      Str = Str & "window.opener. " &
      HttpContext.Cur rent.Request.Qu eryString("form name1") & ".value = '" &
      DDLRm.SelectedV alue & "';"
      Str = Str & "window.opener. " &
      HttpContext.Cur rent.Request.Qu eryString("form name2") & ".value = '" &
      DDLFlr.Selected Value & "';"
      Str = Str & "window.opener. " &
      HttpContext.Cur rent.Request.Qu eryString("form name3") & ".value = '" &
      DDLBldg.Selecte dValue & "';"
      Str = Str & "window.opener. " &
      HttpContext.Cur rent.Request.Qu eryString("form name4") & ".value = '" &
      DDLSite.Selecte dValue & "';"
      Str = Str & "window.opener. " &
      HttpContext.Cur rent.Request.Qu eryString("form name5") & ".value = '" &
      Trim(DDLMvNm.Se lectedValue.Sub string(0,
      DDLMvNm.Selecte dValue.IndexOf( ","))) & "';"
      Str = Str & "window.opener. " &
      HttpContext.Cur rent.Request.Qu eryString("form name6") & ".value = '" &
      Trim(DDLMvNm.Se lectedValue.Sub string(DDLMvNm. SelectedValue.I ndexOf(",")
      + 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 | EKontos@comtekc add.com

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


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

      Comment

      • Peter Huang [MSFT]

        #4
        RE: Opening Multiple Windows

        Hi Evan,

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

        Dim str As String = "<script language
        =javascript>{wi ndow.opener.For m1.TextBox1.val ue
        ='hello';window .close();window .open('http://www.google.com' );}</script>"
        RegisterStartup Script("a", str)

        End Sub


        [WebForm2.aspx.v b add a button onto the WebForm2.aspx]
        Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
        System.EventArg s) Handles Button1.Click
        Dim str As String = "<script language
        =javascript>{wi ndow.open('http ://localhost/WebApplication4/WebForm2.aspx') ;}
        </script>"
        RegisterStartup Script("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.
        --------------------[color=blue]
        >From: Evan Kontos <ekontos@comtek cadd.com>
        >References: <JqArlRfcDHA.22 96@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: <e6WTFlhcDHA.17 72@TK2MSFTNGP10 .phx.gbl>
        >Newsgroups: microsoft.publi c.dotnet.genera l
        >Date: Wed, 03 Sep 2003 05:45:34 -0700
        >NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
        >Lines: 1
        >Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
        >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:107075
        >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
        >
        >
        >Here is the code from the button click from the first form to open the
        >second form.
        >
        >Private Sub BTNSlctMvFrm_Cl ick(ByVal sender As System.Object, ByVal e As
        >System.EventAr gs) Handles BTNSlctMvFrm.Cl ick
        >
        >Dim str As String = "<script language
        >=javascript>{w indow.open('use rselectionform. aspx?formname1= Form1.TBXMvFr
        >mRm&formname2= Form1.TBXMvFrmF lr&formname3=Fo rm1.TBXMvFrmBld g&formname4=F
        >orm1.TBXMvFrmS t&formname5=For m1.TBXMvFrmLNm& formname6=Form1 .TBXMvFrmFNm'
        >,"
        >
        >str += " 'UserSelection' ,'menubar=no,re sizable=no,
        >toolbar=no,scr ollbars=no,top= 100,left=300,he ight=400,width= 300');}</scri
        >pt>"
        >
        >RegisterStartu pScript("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.EventAr gs) Handles BtnCnfmMv.Click
        >
        > Try
        > Dim Str As String = "<script language=""java script"">"
        >
        > Str = Str & "window.opener. " &
        >HttpContext.Cu rrent.Request.Q ueryString("for mname1") & ".value = '" &
        >DDLRm.Selected Value & "';"
        > Str = Str & "window.opener. " &
        >HttpContext.Cu rrent.Request.Q ueryString("for mname2") & ".value = '" &
        >DDLFlr.Selecte dValue & "';"
        > Str = Str & "window.opener. " &
        >HttpContext.Cu rrent.Request.Q ueryString("for mname3") & ".value = '" &
        >DDLBldg.Select edValue & "';"
        > Str = Str & "window.opener. " &
        >HttpContext.Cu rrent.Request.Q ueryString("for mname4") & ".value = '" &
        >DDLSite.Select edValue & "';"
        > Str = Str & "window.opener. " &
        >HttpContext.Cu rrent.Request.Q ueryString("for mname5") & ".value = '" &
        >Trim(DDLMvNm.S electedValue.Su bstring(0,
        >DDLMvNm.Select edValue.IndexOf (","))) & "';"
        > Str = Str & "window.opener. " &
        >HttpContext.Cu rrent.Request.Q ueryString("for mname6") & ".value = '" &
        >Trim(DDLMvNm.S electedValue.Su bstring(DDLMvNm .SelectedValue. 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 | EKontos@comtekc add.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!
        >[/color]

        Comment

        • Evan Kontos

          #5
          RE: Opening Multiple Windows

          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 | EKontos@comtekc add.com

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


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

          Comment

          • Peter Huang [MSFT]

            #6
            RE: Opening Multiple Windows

            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>{wi ndow.opener.For m1.TextBox1.val ue ='hello';var o =
            window.open('ht tp://www.google.com' );o.close();}</script>";
            RegisterStartup Script("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.
            --------------------[color=blue]
            >From: Evan Kontos <ekontos@comtek cadd.com>
            >References: <5F3u08qcDHA.10 68@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: <#66OncvcDHA.26 72@tk2msftngp13 .phx.gbl>
            >Newsgroups: microsoft.publi c.dotnet.genera l
            >Date: Thu, 04 Sep 2003 08:13:52 -0700
            >NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
            >Lines: 1
            >Path:[/color]
            cpmsftngxa06.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
            ..phx.gbl!tk2ms ftngp13.phx.gbl[color=blue]
            >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:107285
            >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
            >
            >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 | EKontos@comtekc add.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!
            >[/color]

            Comment

            • Evan Kontos

              #7
              RE: Opening Multiple Windows

              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 | EKontos@comtekc add.com

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


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

              Comment

              • Peter Huang [MSFT]

                #8
                RE: Opening Multiple Windows

                Hi Evan,
                [color=blue]
                >from Form B. Close Form B then close Form B passing the same data back
                >to the textbox on Form A.[/color]

                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.v b]
                Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
                System.EventArg s) Handles Button1.Click
                Dim str As String = "<script language
                =javascript>{wi ndow.open('http ://localhost/WebApplication4/WebForm2.aspx') ;}
                </script>"
                RegisterStartup Script("adf", Str)
                End Sub

                [WebForm2.aspx.v b]
                Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
                System.EventArg s) Handles Button1.Click
                Dim str As String = "<script language
                =javascript>{wi ndow.open('http ://localhost/WebApplication4/WebForm3.aspx?c on
                tent=" & TextBox1.Text & "');}</script>"
                RegisterStartup Script("a", str)
                End Sub

                [WebForm3.aspx.v b]
                Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                System.EventArg s) Handles MyBase.Load
                TextBox1.Text = Request.QuerySt ring("content")
                End Sub
                Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
                System.EventArg s) Handles Button1.Click
                Dim str As String = "<script language
                =javascript>{wi ndow.opener.ope ner.Form1.TextB ox1.value ='" & TextBox1.Text
                & "';window.close ();window.opene r.close();}</script>"
                RegisterStartup Script("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.
                --------------------[color=blue]
                >From: Evan Kontos <ekontos@comtek cadd.com>
                >References: <Mq4$aL4cDHA.21 6@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: <#EFlGQBdDHA.22 96@TK2MSFTNGP09 .phx.gbl>
                >Newsgroups: microsoft.publi c.dotnet.genera l
                >Date: Fri, 05 Sep 2003 18:13:03 -0700
                >NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
                >Lines: 1
                >Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
                >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:107493
                >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                >
                >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 | EKontos@comtekc add.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!
                >[/color]

                Comment

                Working...