how to open a new browser window when clicked on a button control? - Javascript

This is a discussion on how to open a new browser window when clicked on a button control? - Javascript ; Dear ASP.NET Programmers, I am using the following code block to navigate to the invoice page of my app. when users click on the button btnInvoice. However, I want to display the invoice page in a new browser window. What ...

+ Reply to Thread
Results 1 to 3 of 3

how to open a new browser window when clicked on a button control?

  1. Default how to open a new browser window when clicked on a button control?

    Dear ASP.NET Programmers,

    I am using the following code block to navigate to the invoice page of my
    app. when users click on the button btnInvoice. However, I want to display
    the invoice page in a new browser window. What javascipt code should I use
    instead of Response.Redirect()? Thanks in advance,

    Burak


    Private Sub btnInvoice_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles btnInvoice.Click
    If txtIRD.Text <> "" And txtInvoiceDate.Text <> "" Then
    Response.Redirect("newinvoice_hospital.aspx?mfuid=" +
    Request("mfuid") + "&spid=" + Request("spid"))
    End If
    If txtIRD.Text = "" Then
    Say("Please enter the invoice receipt date")
    End If
    If txtInvoiceDate.Text = "" Then
    Say("Please enter the invoice date")
    End If
    End Sub



  2. Default Re: how to open a new browser window when clicked on a button control?

    Burak,

    As you write, you should use javascript instead of Response.Redirect. And
    all your logic that is currently implemented on server sode should move to
    client side. You don't need server roundtrips to check if a text entry field
    is empty.

    There is a number of javascript calls to open a new browser window.
    window.open(...);
    window.showModalDialog(...);
    window.showModelessDialog(...);

    Eliyahu

    "buran" <b@b.com> wrote in message
    news:%23m00u$qDFHA.4072@TK2MSFTNGP10.phx.gbl...
    > Dear ASP.NET Programmers,
    >
    > I am using the following code block to navigate to the invoice page of my
    > app. when users click on the button btnInvoice. However, I want to display
    > the invoice page in a new browser window. What javascipt code should I use
    > instead of Response.Redirect()? Thanks in advance,
    >
    > Burak
    >
    >
    > Private Sub btnInvoice_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles btnInvoice.Click
    > If txtIRD.Text <> "" And txtInvoiceDate.Text <> "" Then
    > Response.Redirect("newinvoice_hospital.aspx?mfuid=" +
    > Request("mfuid") + "&spid=" + Request("spid"))
    > End If
    > If txtIRD.Text = "" Then
    > Say("Please enter the invoice receipt date")
    > End If
    > If txtInvoiceDate.Text = "" Then
    > Say("Please enter the invoice date")
    > End If
    > End Sub
    >
    >




  3. Default RE: how to open a new browser window when clicked on a button control?

    just insert the following javascript function in between the head tags

    void opennewwindow()
    {
    var w;
    w=window.open("newpage.aspx");
    }

    and insert the following code in the page_load event

    btnInvoice.Attributes.Add("onclick","opennewwindow();")


    Try :-)

    Regards,
    Thangam

    "buran" wrote:

    > Dear ASP.NET Programmers,
    >
    > I am using the following code block to navigate to the invoice page of my
    > app. when users click on the button btnInvoice. However, I want to display
    > the invoice page in a new browser window. What javascipt code should I use
    > instead of Response.Redirect()? Thanks in advance,
    >
    > Burak
    >
    >
    > Private Sub btnInvoice_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles btnInvoice.Click
    > If txtIRD.Text <> "" And txtInvoiceDate.Text <> "" Then
    > Response.Redirect("newinvoice_hospital.aspx?mfuid=" +
    > Request("mfuid") + "&spid=" + Request("spid"))
    > End If
    > If txtIRD.Text = "" Then
    > Say("Please enter the invoice receipt date")
    > End If
    > If txtInvoiceDate.Text = "" Then
    > Say("Please enter the invoice date")
    > End If
    > End Sub
    >
    >
    >


+ Reply to Thread

Similar Threads

  1. Avoiding postback on upload control when another button is clicked
    By Application Development in forum DOTNET
    Replies: 1
    Last Post: 09-03-2007, 02:18 PM
  2. Selecting Radio Button in Web Browser Control
    By Application Development in forum basic.visual
    Replies: 0
    Last Post: 07-24-2007, 07:33 PM
  3. Open a new browser window while viewing a PDFin an existing browser window
    By Application Development in forum Adobe Acrobat
    Replies: 0
    Last Post: 01-22-2007, 10:02 AM
  4. Replies: 5
    Last Post: 10-06-2003, 01:08 PM
  5. Open Pop-Up Window When Link Is Clicked
    By Application Development in forum Javascript
    Replies: 0
    Last Post: 10-03-2003, 10:07 PM