Changing colour of validator error messages

Discussion in 'ASP .Net' started by Helen, Sep 6, 2004.

  1. Helen

    Helen Guest

    I'm having trouble changing the text colour of the validators I'm
    using on a webform.

    I want the styling to be done using a CSS class that is attached to
    the table cell that my validators live in, but this is overriden by
    the inline style that is being output by default.

    This is what I've tried to override the style so far:
    <asp:requiredfieldvalidator id="YesNoValidator" runat="server"
    errormessage="This field is required" controltovalidate="YesNoList"
    display="dynamic">This field is required</asp:requiredfieldvalidator>

    <asp:requiredfieldvalidator id="YesNoValidator" runat="server"
    errormessage="This field is required" controltovalidate="YesNoList"
    display="dynamic" cssClass="validator">This field is
    required</asp:requiredfieldvalidator>

    <asp:requiredfieldvalidator id="YesNoValidator" runat="server"
    errormessage="This field is required" controltovalidate="YesNoList"
    display="dynamic" style="">This field is
    required</asp:requiredfieldvalidator>

    Helen
     
    Helen, Sep 6, 2004
    #1
    1. Advertising

  2. Helen

    Hans Kesting Guest

    "Helen" <> wrote in message news:...
    > I'm having trouble changing the text colour of the validators I'm
    > using on a webform.
    >
    > I want the styling to be done using a CSS class that is attached to
    > the table cell that my validators live in, but this is overriden by
    > the inline style that is being output by default.
    >
    > This is what I've tried to override the style so far:
    > <asp:requiredfieldvalidator id="YesNoValidator" runat="server"
    > errormessage="This field is required" controltovalidate="YesNoList"
    > display="dynamic">This field is required</asp:requiredfieldvalidator>
    >
    > <asp:requiredfieldvalidator id="YesNoValidator" runat="server"
    > errormessage="This field is required" controltovalidate="YesNoList"
    > display="dynamic" cssClass="validator">This field is
    > required</asp:requiredfieldvalidator>
    >
    > <asp:requiredfieldvalidator id="YesNoValidator" runat="server"
    > errormessage="This field is required" controltovalidate="YesNoList"
    > display="dynamic" style="">This field is
    > required</asp:requiredfieldvalidator>
    >
    > Helen


    use ' ForeColor=" " CssClass="<your style class>" ' in your validator.
    By using a space for the color you override the default red color.

    Hans Kesting
     
    Hans Kesting, Sep 6, 2004
    #2
    1. Advertising

  3. Helen

    Helen Guest

    > use ' ForeColor=" " CssClass="<your style class>" ' in your validator.
    > By using a space for the color you override the default red color.
    >


    Thanks :)

    Helen
     
    Helen, Sep 6, 2004
    #3
    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. Vinod I

    Sequence of Validator Error Messages

    Vinod I, Jan 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    357
    Natty Gur
    Jan 28, 2004
  2. Simon Harris

    Datagrid - Changing row colour

    Simon Harris, Feb 9, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    498
    Eliyahu Goldin
    Feb 10, 2005
  3. PC Leung
    Replies:
    4
    Views:
    9,585
    greenleaf81
    Oct 22, 2008
  4. William Park

    changing colour of cursor

    William Park, May 12, 2005, in forum: HTML
    Replies:
    1
    Views:
    429
    Mark Parnell
    May 13, 2005
  5. jodleren
    Replies:
    2
    Views:
    212
    Thomas 'PointedEars' Lahn
    Jan 12, 2008
Loading...

Share This Page