ASP.NET define input validators programmatically depending on configuration

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.

Answers


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


Need Your Help

Check for stdout or stderr

bash shell segmentation-fault stdout stderr

One of the binaries which I am using in my shell script is causing a segmentation fault (RETURN VALUE: 139)

How do I get jQuery to return a table row element when using "this?"

javascript jquery html tablerow

I'm using an asp.net list view control and within it I'm building a table element.