How do I get the input value that was passed to Validation? RRS feed

  • Question

  • User1514925754 posted

    Here I am looping through the validation results and I know it returns Key and Message, but I don't know how to get the input value of the property of the class which it is validation.

     ...validator init..
     ValidationResults results = validator.Validate(SMPCLASS);
     foreach (ValidationResult ValidationResult1 in results)
    	string key = ValidationResult1.Key;
    	string message = ValidationResult1.Message;

    Wednesday, June 8, 2011 1:04 PM


  • User-269404413 posted


    from validationresult class we can get the following members only

      Name Description
    <!--src=[../icons/pubmethod.gif]-->Public method ValidationResult Initializes a new instance of the ValidationResult class.
      Name Description
    <!--src=[../icons/pubproperty.gif]-->Public property ErrorContent Gets an object that provides additional information about the invalidity.
    <!--src=[../icons/pubproperty.gif]-->Public property IsValid Gets a value that indicates whether the value checked against the ValidationRule is valid.
    <!--src=[../icons/pubproperty.gif]-->Public property <!--src=[../icons/static.gif]-->Static member ValidResult Gets a valid instance of ValidationResult.
      Name Description
    <!--src=[../icons/pubmethod.gif]-->Public method Equals Compares the specified instance and the current instance of ValidationResult for value equality. (Overrides Object.Equals(Object).)
    <!--src=[../icons/protmethod.gif]-->Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
    <!--src=[../icons/pubmethod.gif]-->Public method GetHashCode Returns the hash code for this ValidationResult. (Overrides Object.GetHashCode.)
    <!--src=[../icons/pubmethod.gif]-->Public method GetType Gets the Type of the current instance. (Inherited from Object.)
    <!--src=[../icons/protmethod.gif]-->Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
    <!--src=[../icons/pubmethod.gif]-->Public method ToString Returns a string that represents the current object. (Inherited from Object.)
      Name Description
    <!--src=[../icons/puboperator.gif]-->Public operator <!--src=[../icons/static.gif]-->Static member Equality Compares two ValidationResult objects for value equality.
    <!--src=[../icons/puboperator.gif]-->Public operator <!--src=[../icons/static.gif]-->Static member Inequality Compares two ValidationResult objects for value inequality.


    ref. http://msdn.microsoft.com/en-us/library/system.windows.controls.validationresult.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 10, 2011 6:05 AM