I have a webform with a textbox and 3 buttons (add, save and cancel), I’m learning how to use customvalidators (ASP.NET 4.0).
Once the page is loaded, you can only see the add button, after you click on it you can see the textbox and the other 2 buttons.
If textbox is empty I can’t save the record (I get this done successfully with customvalidator and javascript, it shows me the error message “textbox can not be left empty”), but what happens if I don’t want to save the record anymore and want to cancel instead (by clicking on the cancel button while textbox is still empty)?
I get the customvalidator error “textbox can not be left empty”. I have to type something i it so I can do what i need.
Any suggestions?
Thanks in advance
For Cancel button set the attribute CausesValidation=”false”. That is it…