Start validation also without ValidatorAtrributes

Topics: Validation Application Block
Jun 12, 2007 at 4:02 PM
I noticed that without any ValidatorAttribute present on a property of a data-bound object the VAB validation does not fire.

Can I change this behaviour, to validate each property, regardless of validation attributes being present?

My reason is that I want to use the ValueConvert event of the Validation Provider (WinForms) to do the type-checking.

Other solutions?

Jun 13, 2007 at 3:43 PM
I don't know of a solution other than adding a ValidatorAttribute to the extra properties such that the validation will always be true. This way you can still use the ValueConvert Event but never have to worry about the property being invalid. You could make your own custom Validator and ValidatorAttribute that does nothing or use a combination of existing Validators that will always combine to be valid.




David Hayden
Microsoft MVP C#