Changing colour of validator error messages

H

Helen

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
 
H

Hans Kesting

Helen said:
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
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top