Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear controls when using required field validator?

Tags:

c#

asp.net

vb.net

I have a form with a number of textboxes and dropdownlist .. I have a clear Button which upon clicking is supposed to clear all the fields. But since i have required field validators and regular expressions validator on the form I am not able to fire click event unless all validation are satisfied.

like image 294
SamuraiJack Avatar asked May 25 '26 19:05

SamuraiJack


1 Answers

You can use the CausesValidation property

<asp:Button ID="BtnClearForm"
                Text="clear form"
                CausesValidation="False"
                OnClick="BtnClearForm_Click"
                runat="server"/>

Another option is to use javascript to clear your inputs.

like image 119
Tim Schmelter Avatar answered May 28 '26 10:05

Tim Schmelter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!