ASP.NET Define Input Validators Programmatically Depending On Configuration

- 1 answer

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):


and maybe for a second client:


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.


Answer, thats all there is to say when it comes to 3rd party validation suites. Full featured client and serverside api,