I have a field that is not required for 1 sitiuation and need to stop the validation on the save button click and not display the validator or summary. I will then enable both on any event that fires next. How can i do this?
You cannot use reqired field validator, use custom validater and write the function to achieve your requirement. This would be server side or client side. If you use server side, use the IsValide method to validete.
RemyMartin
Member
253 Points
212 Posts
stop RequiredFieldValidator & summary from displaying
Jul 10, 2012 02:25 PM|LINK
I have a field that is not required for 1 sitiuation and need to stop the validation on the save button click and not display the validator or summary. I will then enable both on any event that fires next. How can i do this?
chandana
Participant
1356 Points
378 Posts
Re: stop RequiredFieldValidator & summary from displaying
Jul 10, 2012 02:31 PM|LINK
You cannot use reqired field validator, use custom validater and write the function to achieve your requirement. This would be server side or client side. If you use server side, use the IsValide method to validete.
Thanks
budugu
All-Star
41108 Points
6019 Posts
Re: stop RequiredFieldValidator & summary from displaying
Jul 10, 2012 02:49 PM|LINK
Check validator control's Enabled Property. you can disable validator on page_load and enable it on event code.
"Don't be afraid to be wrong; otherwise you'll never be right."
Ruchira
All-Star
42904 Points
7022 Posts
MVP
Re: stop RequiredFieldValidator & summary from displaying
Jul 11, 2012 01:32 PM|LINK
Hello,
You can call the below script when you need to disable the validator
ValidatorEnable(document.getElementById('<%=ValidatorID.ClientID%>'), false);And when you need to re-enable it
ValidatorEnable(document.getElementById('<%= ValidatorID.ClientID %>'), true);
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.atrifonov
Member
343 Points
63 Posts
Re: stop RequiredFieldValidator & summary from displaying
Jul 11, 2012 01:41 PM|LINK
Hi, If you haven't already done so, set CausesValidation="false" for the Save button. Example:
If needed, disable the RequiredFieldValidator on Click event of the button using: