different colors for messages in the validation summary

G

Guest

Hi,

I am implementing a ASP.Net form that have ValidationSummary. I want to have
different color for an error message (red) and a warning message (blue).

It seems that we cannot have multiple message color in a ValidationSummary so,
I try with two ValidationSummary controls, one that have a forecolor=red and
the other that have forecolor=blue. But the message that I produce is
displaying in both of the controls.

Sample :

If TextBox2.Text = "" Then
ValidationSummaryInfo.Page.Validators.Add(New val("warning"))

If TextBox1.Text = "" Then
ValidationSummaryErr.Page.Validators.Add(New val("error"))

Where "val" is a class that implements IValidator.

Any idea ?

Thanks in advance !
 
P

Peter Blum

Return to using one ValidationSummary since multiple ValidationSummary
controls will list every validator.

Now each validator has two error messages. The Text property shows at the
control's position and the ErrorMessage property appears in the
ValidationSummary. All you need to do is assign the same message to both,
but in the ErrorMessage property, use HTML to change the color. It looks
like this:
"<span style='color:red'>errormessage</span>"

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top