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

B

buran

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
 
E

Eliyahu Goldin

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
 
G

Guest

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
 

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,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top