Custom Validator and specifying type of message
- by user102533
I have a custom validation in the enterprise validation block. The DoValidate method is as shown below.
protected override void DoValidate(Double objectToValidate, object currentTarget, string key, ValidationResults validationResults)
{
if (!IsSalMoreThanMinWage(objectToValidate))
{
//Here I need to mark this message as a "Warning"
LogValidationResult(validationResults, "Salary is too low for this state", currentTarget, key);
}
}
I'd need to mark this validation failure as a "warning" message. In the front end, when I iterate through the ValidationResults collection and grab a ValidationResult object, I would need to identify and group different types of messages and render them differently.
My question is - how do I mark a failure as a warning?