ValidationResult Target SourceInstance

May 12, 2010 at 7:19 AM

In class ValidationResult you have the "Target" and "Property". What I'm missing is the instance of the class containing that property. PropertyInfo contains the ReflectedType but I need the instance. If I'm validation a Collection of Addresses, and the MaxLength of the Address.Name causes an Error in the ValidationResult so I were able in GUI to set the focus on the specific Instance in the GridView Llist.

What do you think about that? Is there another way to accomplish that?

Coordinator
May 13, 2010 at 3:47 AM

Marinko,

If you look at the example ValidationNotification at http://specexpress.codeplex.com/wikipage?title=Validate you'll see that Target contains a reference to the object that was used during the validation. 

I actually found an issue in rule validators dealing with Lengths which is returning the length of the string for Target instead of the original value. We'll look at this issue soon.

Will Target work for you in this situation?