ASP.Net验证程序默认样式 [英] ASP.Net Validator Default Style

查看:467
本文介绍了ASP.Net验证程序默认样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Validator控件的几种变体(RequiredFieldValidator,CompareValidator等),并且正在使用Validator的CssClass属性.我可以看到(通过Firebug)正在应用该类,但是验证器控件本身正在向其中添加一个样式元素,即color:red.但是我不想要那个.我希望控件仅使用cssclass.

I'm using several variants of the Validator controls (RequiredFieldValidator, CompareValidator, etc) and am using the CssClass property of the validator. I can see (via Firebug) that the class is being applied, but the validator control itself is adding a style element to it, namely color: red. But I don't want that. I want the control to use the cssclass only.

我知道我可以覆盖Forecolor属性,但是我必须在项目中的每个验证器上执行此操作.而且我真的很想能够在样式表中更改CSS类,以防将来我们必须更改所有错误消息的外观.

I know I can override the Forecolor attribute, but I'll have to do that on every validator in the project. And I'd really like to be able to just change my CSS Class in my stylesheet in case we have to change all the error message appearances in the future.

有人知道如何告诉Validator控件不要使用其默认样式吗?

Anyone have any clues how to tell the Validator controls to NOT use their default styles?

推荐答案

您可以在CSS文件中执行此操作:

You can do this in your css file:

.validator
{
    color: blue !important;
}

这将覆盖嵌入式红色样式.

This will override the inline red style.

这篇关于ASP.Net验证程序默认样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆