How to send a pop up window from .vb file.

Discussion in 'ASP .Net' started by Lily, Nov 20, 2003.

  1. Lily

    Lily Guest

    Hi there, please help on why this is happening:
    I have tried to the following on my button click event, nothing is happening, no pop up new window. I could not think of anything wrong here.
    '********
    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

    If CheckBalance() = 1 Then

    Dim str As String = "<script language=""javascript"">" & _

    " function openpopup(){ " & _

    "winpops = window.open(""co2.aspx"", """", ""alwaysRaised,width=400,height=338,"")" & _

    "} " & _

    " openpopup();" & _

    "</script>"

    Response.Write(str)

    End If

    End Sub

    '********
     
    Lily, Nov 20, 2003
    #1
    1. Advertising

  2. Lily,

    It's because nothing is calling the function when it's placed on the page.

    Instead using response.write to place the script on the page try using
    Page.RegisterStartUpScript instead.

    If you'd like, I've created a Javascript component that can be placed on any
    page and contains many useful javascripts for use in .Net, including a popup
    window that can be attached to almost any .net object be it a button, drop
    down, or whatever.

    The component is free and you can download a help file for it and the full
    source code. Just go to my site, www.aboutfortunate.com, click on the code
    library link and then click on the Javascript button in the menu on the
    left.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Lily" <> wrote in message
    news:%...
    Hi there, please help on why this is happening:
    I have tried to the following on my button click event, nothing is
    happening, no pop up new window. I could not think of anything wrong here.
    '********
    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles btnCalculate.Click

    If CheckBalance() = 1 Then

    Dim str As String = "<script language=""javascript"">" & _

    " function openpopup(){ " & _

    "winpops = window.open(""co2.aspx"", """",
    ""alwaysRaised,width=400,height=338,"")" & _

    "} " & _

    " openpopup();" & _

    "</script>"

    Response.Write(str)

    End If

    End Sub

    '********
     
    S. Justin Gengo, Nov 20, 2003
    #2
    1. Advertising

  3. Lily

    Lily Guest

    Thanks a lot!
    "S. Justin Gengo" <> wrote in message
    news:u%...
    > Lily,
    >
    > It's because nothing is calling the function when it's placed on the page.
    >
    > Instead using response.write to place the script on the page try using
    > Page.RegisterStartUpScript instead.
    >
    > If you'd like, I've created a Javascript component that can be placed on

    any
    > page and contains many useful javascripts for use in .Net, including a

    popup
    > window that can be attached to almost any .net object be it a button, drop
    > down, or whatever.
    >
    > The component is free and you can download a help file for it and the full
    > source code. Just go to my site, www.aboutfortunate.com, click on the code
    > library link and then click on the Javascript button in the menu on the
    > left.
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > Free code library at:
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Lily" <> wrote in message
    > news:%...
    > Hi there, please help on why this is happening:
    > I have tried to the following on my button click event, nothing is
    > happening, no pop up new window. I could not think of anything wrong

    here.
    > '********
    > Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles btnCalculate.Click
    >
    > If CheckBalance() = 1 Then
    >
    > Dim str As String = "<script language=""javascript"">" & _
    >
    > " function openpopup(){ " & _
    >
    > "winpops = window.open(""co2.aspx"", """",
    > ""alwaysRaised,width=400,height=338,"")" & _
    >
    > "} " & _
    >
    > " openpopup();" & _
    >
    > "</script>"
    >
    > Response.Write(str)
    >
    > End If
    >
    > End Sub
    >
    > '********
    >
    >
     
    Lily, Nov 20, 2003
    #3
  4. Lily

    Lily Guest

    Thanks a lot!
    "S. Justin Gengo" <> wrote in message
    news:u%...
    > Lily,
    >
    > It's because nothing is calling the function when it's placed on the page.
    >
    > Instead using response.write to place the script on the page try using
    > Page.RegisterStartUpScript instead.
    >
    > If you'd like, I've created a Javascript component that can be placed on

    any
    > page and contains many useful javascripts for use in .Net, including a

    popup
    > window that can be attached to almost any .net object be it a button, drop
    > down, or whatever.
    >
    > The component is free and you can download a help file for it and the full
    > source code. Just go to my site, www.aboutfortunate.com, click on the code
    > library link and then click on the Javascript button in the menu on the
    > left.
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > Free code library at:
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Lily" <> wrote in message
    > news:%...
    > Hi there, please help on why this is happening:
    > I have tried to the following on my button click event, nothing is
    > happening, no pop up new window. I could not think of anything wrong

    here.
    > '********
    > Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles btnCalculate.Click
    >
    > If CheckBalance() = 1 Then
    >
    > Dim str As String = "<script language=""javascript"">" & _
    >
    > " function openpopup(){ " & _
    >
    > "winpops = window.open(""co2.aspx"", """",
    > ""alwaysRaised,width=400,height=338,"")" & _
    >
    > "} " & _
    >
    > " openpopup();" & _
    >
    > "</script>"
    >
    > Response.Write(str)
    >
    > End If
    >
    > End Sub
    >
    > '********
    >
    >
     
    Lily, Nov 20, 2003
    #4
  5. Lily

    Lily Guest

    Thanks a lot for responding with such a speed!

    now pop up window is out, but it won't stay on top even through I userd
    "alwaysRaised":
    *************
    If CheckBalance() = 1 Then

    If Not Page.IsClientScriptBlockRegistered("PopUpWindowv10") Then

    Dim msbHTML As New System.Text.StringBuilder()

    msbHTML.Append("<script language=""javascript"">" & vbCrLf)

    msbHTML.Append("window.open('co2.aspx', '',
    'alwaysRaised,width=400,height=338,')" & vbCrLf)

    msbHTML.Append("</script>" & vbCrLf)

    Page.RegisterClientScriptBlock("PopUpWindowv10", msbHTML.ToString)

    End If

    End If

    ************************************

    "S. Justin Gengo" <> wrote in message
    news:u%...
    > Lily,
    >
    > It's because nothing is calling the function when it's placed on the page.
    >
    > Instead using response.write to place the script on the page try using
    > Page.RegisterStartUpScript instead.
    >
    > If you'd like, I've created a Javascript component that can be placed on

    any
    > page and contains many useful javascripts for use in .Net, including a

    popup
    > window that can be attached to almost any .net object be it a button, drop
    > down, or whatever.
    >
    > The component is free and you can download a help file for it and the full
    > source code. Just go to my site, www.aboutfortunate.com, click on the code
    > library link and then click on the Javascript button in the menu on the
    > left.
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > Free code library at:
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Lily" <> wrote in message
    > news:%...
    > Hi there, please help on why this is happening:
    > I have tried to the following on my button click event, nothing is
    > happening, no pop up new window. I could not think of anything wrong

    here.
    > '********
    > Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles btnCalculate.Click
    >
    > If CheckBalance() = 1 Then
    >
    > Dim str As String = "<script language=""javascript"">" & _
    >
    > " function openpopup(){ " & _
    >
    > "winpops = window.open(""co2.aspx"", """",
    > ""alwaysRaised,width=400,height=338,"")" & _
    >
    > "} " & _
    >
    > " openpopup();" & _
    >
    > "</script>"
    >
    > Response.Write(str)
    >
    > End If
    >
    > End Sub
    >
    > '********
    >
    >
     
    Lily, Nov 20, 2003
    #5
  6. Lily

    Lily Guest

    Ok, I got it.
    I used window.alert instead of window.open to put pop up window stays on
    top of all other windows.

    Thanks.

    "S. Justin Gengo" <> wrote in message
    news:u%...
    > Lily,
    >
    > It's because nothing is calling the function when it's placed on the page.
    >
    > Instead using response.write to place the script on the page try using
    > Page.RegisterStartUpScript instead.
    >
    > If you'd like, I've created a Javascript component that can be placed on

    any
    > page and contains many useful javascripts for use in .Net, including a

    popup
    > window that can be attached to almost any .net object be it a button, drop
    > down, or whatever.
    >
    > The component is free and you can download a help file for it and the full
    > source code. Just go to my site, www.aboutfortunate.com, click on the code
    > library link and then click on the Javascript button in the menu on the
    > left.
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > Free code library at:
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Lily" <> wrote in message
    > news:%...
    > Hi there, please help on why this is happening:
    > I have tried to the following on my button click event, nothing is
    > happening, no pop up new window. I could not think of anything wrong

    here.
    > '********
    > Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles btnCalculate.Click
    >
    > If CheckBalance() = 1 Then
    >
    > Dim str As String = "<script language=""javascript"">" & _
    >
    > " function openpopup(){ " & _
    >
    > "winpops = window.open(""co2.aspx"", """",
    > ""alwaysRaised,width=400,height=338,"")" & _
    >
    > "} " & _
    >
    > " openpopup();" & _
    >
    > "</script>"
    >
    > Response.Write(str)
    >
    > End If
    >
    > End Sub
    >
    > '********
    >
    >
     
    Lily, Nov 20, 2003
    #6
  7. Lily

    SamP

    Joined:
    Jun 20, 2008
    Messages:
    1
    I am using ASP2.0 .net with VB. I have set my site to write code behind.
    When applying the same code VB does not recognize "window.open".
    Am I missing something
     
    SamP, Jun 20, 2008
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    8,532
    Randy Webb
    Feb 4, 2006
  2. Shiperton Henethe
    Replies:
    17
    Views:
    5,403
    Deirdre Saoirse Moen
    May 21, 2004
  3. J P Singh
    Replies:
    3
    Views:
    311
    Howard Rothenburg
    Feb 11, 2004
  4. Madame Blablavatsky
    Replies:
    8
    Views:
    174
    Dr John Stockton
    Sep 16, 2005
  5. carrajo
    Replies:
    2
    Views:
    133
    scripts.contact
    May 21, 2007
Loading...

Share This Page