dialog box and button

  • Thread starter Thread starter bob
  • Start date Start date
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
 
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.
 
Back
Top