views:

563

answers:

1

If I add CustomValidation on a class or a class property, how do I trigger that from code?

Thanks, Mark

+2  A: 

If triggering from a class then you use

Validator.ValidateObject(classNameToBeValidated, new ValidationContext(classNameToBeValidated,null,null);

If on a single property use Validator.ValidateProperty....

Calanus