Getting access to the source object of the property being validated

Topics: Validation Application Block
Jun 6, 2010 at 11:47 AM

I am creating a custom validator for a property on an object. Lets call the property X.

The value of X needs to be validated against other properties of the same parent object.

How can I do this if the only method I can override is DoValidate?


currentTarget seems to be an object of type ValidatedControlItem, and the Hands on Labs I downloaded points to the winforms Textbox control rather than the source object.

protected override void DoValidate(string objectToValidate, object currentTarget, string key, ValidationResults validationResults)

Jun 6, 2010 at 1:22 PM

Turns out object currentTarget is the parent object :-)