dialog box and button

B

bob

I have a button on a web form in which I am calling some
javascript. The button opens up another browser window as
a dialog box. The problem is that I do not want the page
to be resubmitted first to the server before the dialog
opens. I would rather it just open up. Here is the code
below - can anyone give me a clue as to what I am doing
wrong?

Private Sub Button8_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button8.Click
Dim sWindow As String = "mywindow"
Dim jscript As String

jscript = "<script language='JavaScript'>mywindow
= window.open('DrawingReceived.aspx?JobId=" & JobNo.Text
& "&TransmittalId=" & TransmittalId.Text & "','" +
sWindow
+ "','height=600,width=532,toolbars=yes,resizable=yes,scro
ll=yes,scrollbars=1')</script>"

RegisterClientScriptBlock("mywindow", jscript)
End Sub
 
K

Kevin Spencer

Well, what you're doing wrong is writing a server-side event handler for a
Server Control Button to open the window. The only way that code will be
executed is via PostBack Instead, you can use an HTML button, and simply add
a client-side JavaScript "onclick" event handler to open the new window.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.
 

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,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top