I have a page using .NETs server-side input validation controls. This page also has a javascript confirm box that fires when the form is submitted. Currently when the Submit button is selected, the javascript confirm box appears, and once confirmed the ASP.NET server-side validation controls are fired. I would like to fire the server-side validation controls BEFORE the javascript confirm box is displayed.
How can this be accomplished? Ive included a sample of my current code below.
sample.aspx
<asp:textbox id=foo runat=server />
<asp:requiredfieldvalidator id=val runat=server controltovalidate=foo />
<asp:button id=submit runat=server onClientClick=return confirm('Confirm this submission?') />
sample.aspx.vb
Sub Page_Load()
If Page.IsPostback() Then
Page.Validate()
If Page.IsValid Then
'process page here'
End If
End If
End Sub
Thanks for any help.