VAB - Access to validation messages

Topics: Validation Application Block
Jul 11, 2007 at 4:57 AM
Hi there,

I am doing some research into the Validation Application Block to assess its appropriateness for a particular ASP.NET application.
So far it looks great and I would like to thank the P&P team for another great block.

The one thing that is holding me back from giving the all clear to use the VAB is that the application we are developing requires qualified error messages. For example, on some pages we may have repeated form fields for two instances of a particular object, in one instance there will be two address blocks, one for residence and the other for correspondence/mail. As they will be saving to the same business object (i.e. Address.cs) I require a method of qualifying the validation messages in order to distinguish between two fields.

1. * The postcode you have entered is invalid.
* The postcode you have entered is invalid.

2. * The home postcode you have entered is invalid
* The correspondence postcode you have entered is invalid

1 is what would occur from normal use of the VAB as I have encountered in my research so far, 2 is the desired behaviour.

I was looking at extending the PropertyProxyValidator class and allowing the setting of a QaulifierString in the markup (or code behind if there was a need for dynamic messages).

I am interested to hear if others have encountered this and resolved it or if there is something already implemented that I have missed so far.