different colors for messages in the validation summary

Discussion in 'ASP .Net' started by =?Utf-8?B?c3lsdmFpbg==?=, Jul 21, 2005.

  1. 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 !
     
    =?Utf-8?B?c3lsdmFpbg==?=, Jul 21, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?c3lsdmFpbg==?=

    Peter Blum Guest

    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:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "sylvain" <> wrote in message
    news:...
    > 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 !
     
    Peter Blum, Jul 21, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Connolly

    Validation Summary not showing error messages

    Thomas Connolly, Jul 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    696
    Thomas Connolly
    Jul 9, 2003
  2. Teemu Keiski
    Replies:
    0
    Views:
    521
    Teemu Keiski
    Jul 9, 2003
  3. Lucas Tam
    Replies:
    0
    Views:
    569
    Lucas Tam
    Feb 26, 2004
  4. AAaron123

    TreeNode colors come from anchor colors

    AAaron123, Aug 7, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    564
    darrel
    Aug 7, 2008
  5. ZelluX
    Replies:
    3
    Views:
    1,963
    Peter Otten
    Dec 1, 2008
Loading...

Share This Page