Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 11, 2012 01:41 PM by atrifonov
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?
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.
Jul 10, 2012 02:49 PM|LINK
I will then enable both on any event that fires next. How can i do this?
Check validator control's
Enabled Property. you can disable validator on page_load and enable it on event code.
Jul 11, 2012 01:32 PM|LINK
You can call the below script when you need to disable the validator
And when you need to re-enable it
ValidatorEnable(document.getElementById('<%= ValidatorID.ClientID %>'), true);
Please 'Mark as Answer' if this post helps you.
Jul 11, 2012 01:41 PM|LINK
Hi, If you haven't already done so, set CausesValidation="false" for the Save button. Example:
<asp:Button ID="yourButton" runat="server" CausesValidation="false" Text="Save" />
If needed, disable the RequiredFieldValidator on Click event of the button using:
RequiredFieldID.Enabled = false;