Extensions.Register() method clears default client validation

Jul 28, 2011 at 2:33 PM
Edited Jul 28, 2011 at 9:00 PM

Why MVCControlsToolkit.Core.Extensions.Register() method clears System.Web.Mvc.ClientDataTypeModelValidatorProvider from ModelValidatorProviders.Providers collection? After call to Register() method client validation do not works. Did I miss something?

UPDATE: Now I see why: It is because of the new lines of code added to Register() method:

ModelValidatorProviders.Providers.Clear();
ModelValidatorProviders.Providers.Add(new DataAnnotationsModelValidatorProviderExt());

Is this mistake in code that clears all providers? Maybe it should clear only specific providers?

Coordinator
Jul 28, 2011 at 9:24 PM

It is a bug| This is an issue we have discovered soon after having released the RTW. The ClientValidator, that substantially, is responsible for adding unobtrusive validation for controlling the number format, has been cleared because we prepared a custom version of this validator. Unluckly we moved this task to another release without re-adding the old Validator.

In a short time (7-10 days) we will release an SP1 with the new custom version of the validator, that will allow the customization of the format error message (that is impossible with the actual Mvc 3 version), and another couple of bugs, plus an enhacement of the TypedTextBox and TypedEditDisplay. In the meantime you can re-add it:

ModelValidatorProviders.Providers.Add(new ClientDataTypeModelValidatorProvider());

Sorry for the inconvenience!
Coordinator
Jul 28, 2011 at 9:25 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 28, 2011 at 9:46 PM

Thanks for response. It is good news for me. I'm new to MVC applications and I wasn't sure whether I made mistake or not. Now I know that I'm starting to understand how this stuff is working. Thanks for workaround!