I currently have a page set up with .NET server-side input validation controls. There is also a javascript confirm box that pops up when the form is submitted. Right now, the javascript confirm box appears first when the Submit button is clicked, and only after confirmation are the ASP.NET server-side validation controls triggered. However, I would like to reverse this order so that the server-side validation controls are fired BEFORE the javascript confirm box is shown.
Do you know how I can achieve this? Below is a snippet of my existing code for reference:
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
Any assistance on this matter would be greatly appreciated. Thank you.