how can i make Valdator's color red?

Rohan picture Rohan · Jan 16, 2012 · Viewed 10.3k times · Source

i have a problem that i have specified the color of RequiredFieldValidator to red but when i publish the website on net the color of RequiredFieldValidator is changed to black. it works fine in localhost. what could be the problem ? thanks in advance..

this is the image like what i want

Answer

AnotherDeveloper picture AnotherDeveloper · Nov 10, 2012

Rohan,

This may have been your issue. I had the same problem.

By default, framework 4.0 will make all validator error messages black. You will need to explicitly set the ForeColor of all validators to red if you target framework 4.0.

Your source output in 3.5:

<span id="ctl01_YourControl" style="color:Red;visibility:hidden;">*</span>

Your source output in 4.0:

<span id="ctl01_YourControl" style="visibility:hidden;">*</span>