473,387 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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
Nov 19 '05 #1
2 1366
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:%2****************@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

Nov 19 '05 #2
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wes | last post by:
This should be really simple ... but how to do it has been eluding me ... I am writing an ASP.NET application and am using ASP.ImageButtons & ASP.Buttons. Instead of redirecting to another...
3
by: Leonard | last post by:
I have a button on my web app, that opens a help html page. I use this code: HttpContext.Current.Response.Write("<script>") HttpContext.Current.Response.Write("window.open('" & sUrl & "','_new')")...
2
by: Miguel Dias Moura | last post by:
Hello, i want to open a new window when a button is clicked. I am working in ASP.net / VB. However my code is not working. This is my Script Code: <script runat="server"> Private Sub...
3
by: Lisa | last post by:
If anyone knows how I could go about doing the following, I would greatly appreciate some info. I have an aspx page that has some fields for user input as well as a button. When the button is...
6
by: shil | last post by:
I have a server side button that needs to do some preperation and afterwards, if everything goes well, open a new browser with a specific url. I know how to execute javascript from a server side...
6
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.net page with a button. When the button is clicked i want to open a new Browser window (400x200px) having only the title bar and nothing else.This browser window would load...
6
by: hemant.singh | last post by:
Hi all, I am trying to get a way by which I'll know exactly when user goes out of my site by clicking on close button in browser, So that w/e user click close button in browser, I can send a...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
21
by: David C | last post by:
I have an ASP.Net page that does a Response.Redirect to a code-created url. Is there any way to code the redirect to open a new window similar to the Javascript window.open() ? Thanks. David
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.