Hi guys, I have two buttons on my page, the first page is View Button and the second is Update Button. View button display’s member’s personal profile. If I click on the view button, my custom validator automatically trigger, meaning, it automatically displays the error message. Whereas, the custom validator must trigger if I click on the Update button. How am be able to deal with this kind of problem.
Does the validator fire correctly when you press the Update button?
if so, have a look at the Control.CausesValidation property on the View button, and set it to false. This should prevent the validator from triggering.
For custom controls, follow FatalFly advice and set the button to:
<asp:Button CausesValidation=“False” />
Also, if you have validation on the client-side (jQuery/Javascritpt) through the Custom Validator, you need to set another value:
<asp:Button EnableClientScript=“False” />
Hope it helps.
Does the validator fire correctly when you press the Update button?
It seems the validator doesn’t work correctly when I click on the Update button. Although, I set the View button’s CausesValidation property to False.
But the validator fires correctly after I set the CauseValidation property of the View button to false.
Sounds like you need to use ValidationGroup.
Thanks to all of you guys, especially imaginekitty you save my day. I’m almost stuck. Thanks a lot. And now I can proceed.