Validating two usercontrols
By far the most common use of the validation action is to add validation error message to the errors collection, but theoretically you could do anything you want.Because adding validation error messages to the errors collection is such a common scenario, Spring.
NET validation mechanism to the one offered by Spring. Both frameworks will allow you to perform very complex validations but we designed the Spring.NET validation framework differently for the reasons described below.On the Windows Forms side the situation is even worse.One thing to remember is that a validator group is a validator like any other and can be used anywhere validator is expected.You can nest groups within other groups and reference them using validator reference syntax (described later), so they really allow you to structure your validation rules in the most reusable way.This means that you can easily compare numbers and dates without having to worry if the string representation is comparable.
Required validator is also one of the most commonly used ones, and it is much more powerful than the ASP.
NET validation framework, because in many cases specific validators need to be turned on or off based on the values of the object being validated. In order to achieve that we created following validator definition: Validation actions are executed every time the containing validator is executed.
For example, when validating a Trip object we need to validate return date only if the Trip. They allow you to do anything you want based on the result of the validation.
However, condition validator is still your best bet if you need to check whether particular value belongs to a particular range, or perform a similar test, as those conditions are fairly easy to write. NET Validation Framework typically works with domain objects.
This is after data binding from the controls has been performed so that the object being validated is strongly typed.
In this example the Starting From property of the Trip object is compared to see if it is later than the current date, i.e. The condition validator could be considered "the mother of all validators".