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. Advertisements

  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. Advertisements

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. Libs
    Replies:
    0
    Views:
    1,711
  2. Thomas Connolly

    Validation Summary not showing error messages

    Thomas Connolly, Jul 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    804
    Thomas Connolly
    Jul 9, 2003
  3. Lucas Tam
    Replies:
    2
    Views:
    1,277
    Lucas Tam
    Feb 26, 2004
  4. Lucas Tam
    Replies:
    0
    Views:
    615
    Lucas Tam
    Feb 26, 2004
  5. Chris Rumsey via .NET 247

    Validation Summary controlling the order of messages

    Chris Rumsey via .NET 247, Sep 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,793
    Peter Blum
    Sep 6, 2004
  6. AAaron123

    TreeNode colors come from anchor colors

    AAaron123, Aug 7, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    705
    darrel
    Aug 7, 2008
  7. ZelluX
    Replies:
    3
    Views:
    2,450
    Peter Otten
    Dec 1, 2008
  8. Chris Rumsey via .NET 247

    Validation Summary - controlling order that error messages are listed

    Chris Rumsey via .NET 247, Sep 15, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    257
    Chris Rumsey via .NET 247
    Sep 15, 2004
Loading...