The PropertyProxyValidator
doesn't help you with client side validation. I think the main difference with 'throwing in a label in the UI and populating the errors on the server side' is that the PropertyProxyValidator
enables you to have the validation errors next to the validated control.
Using the PropertyProxyValidator
is a lot of work. Everything has to be hooked up. A nicer solution is to create a simple extension method and register the PropertyProxyValidator
in the code behind. This makes everything so much easier. Here is an example:
protected override void OnPreInit(EventArgs e)
{
this.LastNameTextBox.For<Person>().AddValidator(p => p.LastName);
base.OnPreInit(e);
}
You can find more information about this approach here.
Of course, it's still server side in that case, but this solution makes it much easier to enable client side validation later on, because the it centralizes the creation of the validators.
Tuzo already referenced this article. It's the only reference about client side validation with VAB I've found on the web.