I'm writing an ASP.NET 3.5 web application. There is a rather complex input form (30 input controls - TextBoxes, Dropdownlists, ...).
Now, different clients use the same form in their customized application and there are different mandatory fields for some clients.
Now, I'd like to programmatically create/activate certain validators depending on configuration settings, like (I'm simplifying here):
ControlsToValidateRequiredFields="NameTextBox,AddressTextBox,EmailTextBox"
and maybe for a second client:
ControlsToValidateRequiredFields="NameTextBox,PhoneTextBox"
Is there a ASP.NET-built-in way (or a 3rd party control) to do that? I'd like to avoid defining all validators on the page and disabling them. Can I dynamically create and attach Validators to existing controls?
Note: I'd like to validate on client-side. BTW: I'm using the ASP.NET Ajax ControlToolkit's ValidatorCalloutExtender - but it is not a must. And yes, a jQuery-based solution would be okay.