Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET: avoid RequiredFieldValidator on navigate button postback

I have an ASPX page with two RequiredFieldValidator and a button to go to another page. This button must do a postback to know where to go. This button can be clicked it any time.

The problem is that the RequiredFieldValidators are not disabled and show their message asking for a value.

Is there any way to avoid validation when the user click this special button?

Thank you!

like image 463
VansFannel Avatar asked May 24 '09 17:05

VansFannel


3 Answers

Set CausesValidation to false on the special button, or put the RequiredFieldValidators in a ValidationGroup with whatever should cause the validation. (The button that should cause validation and the validators should all be in the same validation group) The first option should work and be the quickest.

like image 144
wulimaster Avatar answered Sep 28 '22 03:09

wulimaster


CausesValidation="false"

like image 37
feihtthief Avatar answered Sep 28 '22 04:09

feihtthief


You can add a ValidationGroup to the controls.

On the submit button you also add a Validationgroup

like image 41
janhartmann Avatar answered Sep 28 '22 03:09

janhartmann