Print Page | Close Window

Change VerifierResult Description

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1340
Printed Date: 15-Apr-2025 at 6:38am


Topic: Change VerifierResult Description
Posted By: swylie
Subject: Change VerifierResult Description
Date Posted: 22-Jun-2009 at 3:29pm

What is the best way to change the RequiredVerifier's description.  It is picking up by default the string name of the property.  The property value name in the model is different than the UI has.  I want to override the description returned when the verifier returns.




Replies:
Posted By: eileenv
Date Posted: 25-Jun-2009 at 3:56pm

Do you want the property name to be changed for all verifiers registered for that type and property name?

If so, one way to do it is to register a PropertyNameToDisplayNameTranslator delegate on the VerifierEngine.
 
For example:
 
      _verifierEngine.PropertyNameToDisplayNameTranslator = delegate(Type pType, String pPropertyName) {
        if ((pType == typeof(Employee)) && pPropertyName.Equals("City")) {
          pPropertyName = "NewCity";
        }
        return pPropertyName;
      };
 
The above would substitute "City" with "NewCity" in the description of any verifier registered on the VerifierEngine associated with type=Employee and propertyName="City".



Print Page | Close Window