Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > different colors for messages in the validation summary

Reply
Thread Tools

different colors for messages in the validation summary

 
 
=?Utf-8?B?c3lsdmFpbg==?=
Guest
Posts: n/a
 
      07-21-2005
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 !
 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      07-21-2005
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"sylvain" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 !



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any library that can convert RGB colors to ANSI colors? ZelluX Python 3 12-01-2008 11:08 AM
TreeNode colors come from anchor colors AAaron123 ASP .Net 1 08-07-2008 07:56 PM
Validation Summary - Adding Error Messages Lucas Tam ASP .Net 0 02-26-2004 03:10 AM
Re: Validation Summary not showing error messages Teemu Keiski ASP .Net 0 07-09-2003 09:52 PM
Validation Summary not showing error messages Thomas Connolly ASP .Net 0 07-09-2003 02:10 PM



Advertisments