I am trying to clear two different text boxes when the compare validation fails. I have tried doing it using the .clear method in the C# code but VS won’t allow it in a web form. I am using Visual Studio 2010 and have hardly any asp.net experience. Any help would be appreciated.
I have tried clearing the text box multiple ways when user presses ‘Submit’ in the Else statement of the validator.isvalid. But it seems that the procedure won’t fire unless the entire page is valid.
Here’s the code for the submit button:
If valCompPassword.IsValid Then
If Page.IsValid Then
lblWelcome.Text = "Welcome " & txtNameFull.Text & "!"
End If
Else
txtPassword.Text = ""
End If
Is there anyway to bypass the validation and fire the procedure?
Have you checked the property of the control (i.e. TextBox, Button etc) CausesValidation? http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.causesvalidation.aspx