How to Ignore the RequiredFieldValidator when i click on Cancel.

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
 
A

Ashish M Bhonkiya

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
 
A

avnrao

this question was asked yesterday i guess..
set CausesValidation property to false for that button.

Av.
 
Joined
May 5, 2008
Messages
1
Reaction score
0
What if...

Hi.

I have this exact same setup, and I do have CausesValidation set to false on my cancel button. The trouble is, when I click cancel, I still get the validation message. Changing the cancel button's Validation group didn't help either.

Any suggestions will be welcome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top