Re: IValidator - multiple error messages
From: Peter Blum (PLBlum_at_Blum.info)
Date: Tue, 7 Dec 2004 11:13:35 -0500
A big focus of my business is data entry validation on webforms. So I have
some knowledge of the issues you raise.
* You can certainly write out a single string, containing all of your error
messages. There are two ways. Use a Label that you assign the text and make
visible when there is an error. Use a CustomValidator and within the
"evaluation function" that you write, you do all that validation and assign
the ErrorMessage property.
* There are formatting challenges when you have lengthy strings displayed in
the web form. Often users like to delegate a lengthy list of error messages
to the ValidationSummary control which groups them together and shows them
as a list.
* The ValidationSummary control is designed for single validation errors so
that it's formatting rules can build separate lines for each error found.
* Recommendation: Use the ValidationSummary control. Add a PlaceHolder
control somewhere to the page. For each error message that you get back,
create a CustomValidator object with its ErrorMessage assigned and its
Display property set to None. Set it to an "evaluation function" that simply
evaluates as "invalid". This way, you are creating a list of error messages
on the fly that will appear in the ValidationSummary.
--- Peter Blum
Creator of "Professional Validation And More" at
"Peter Morris [Air Software Ltd]" <firstname.lastname@example.org> wrote in
> Hi all
> I want a validator which
> A) Doesn't validate a control
> B) Is able to report more than one error
> The reason for this is that I am validating a whole business object based
> on a list of expressions, rather than individual controls.
> Is it possible to do this? Could someone please tell me how, because I
> can only see IValidator and the ability to add a single error from my
> single class (I don't want to use multiple validators).
> Audio compression components, DIB graphics controls, FastStrings
> Read or write articles on just about anything
> My blog