Custom Validator and specifying type of message

Posted by user102533 on Stack Overflow See other posts from Stack Overflow or by user102533
Published on 2010-03-29T19:37:34Z Indexed on 2010/03/30 3:23 UTC
Read the original article Hit count: 269

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?

© Stack Overflow or respective owner

Related posts about enterprise-library

Related posts about validation