How to Ignore the RequiredFieldValidator when i click on Cancel.

  • Thread starter Thread starter RSB
  • Start date Start date
R

RSB

Hi every one ,

i am creating this form and i have two asp:Linkbuttons one for save and one
for Cancel.

Now i also have some RequiredFieldValidators on this Form and i only want to
Execute those once i click on Save but not when i click Cancel.

Also for the Cancel button i am executing some code at the Server to take
some actions.

please help.
Thanks

RSB
 
Hi RSB,

The solution is again very simple. If you are dont want to execute any
validators getting fired you can set the causes validation to false for the
cancel linkbutton, this will allow you to post the form without the
validators getting fired.

You may also try disabling the validators which you dont want to get fired
on client side using javascript on the click of cancel link button. This
exercise of disabling the validators you also need to do on the
btncancel_click on server and proceed with what all validations you want to
do on the server.

HTH
Regards
Ashish M Bhonkiya
 
this question was asked yesterday i guess..
set CausesValidation property to false for that button.

Av.
 
Back
Top