【问题标题】:ValidationSummary style not displaying in IE 6 on Post asp.netValidationSummary 样式未在 Post asp.net 上的 IE 6 中显示
【发布时间】:2010-11-16 11:45:46
【问题描述】:

我正在发回服务器以检查数据库以查看我们是否拥有参考号。如果参考号不存在,我将两个自定义验证器设置为无效并更改 ValidationSummary 标题文本。问题是我在css类中设置的背景色不显示。字体颜色显示正确。

当使用客户端脚本显示验证摘要时,样式会正确显示。我不知道为什么当有回帖时他们不这样做。

css

.form-box .form-error-box {
    background: #cd3300 url("../../../images/alert.gif") no-repeat 10px 10px;
    color: #ffffff;
    font-weight:bold;
    padding:10px;
    padding-left: 80px;
    min-height:55px;
}

代码

<asp:validationsummary id="vSummary" cssclass="form-error-box" displaymode="BulletList" headertext="An error has occured" runat="server" backcolor="" forecolor="" />

这可以在 Firefox 和 IE 8 上发布,但不适用于 IE 6。不幸的是我必须支持 IE 6

【问题讨论】:

  • 请从查看源代码添加渲染代码以进行验证。

标签: asp.net css internet-explorer-6 customvalidator validationsummary


【解决方案1】:

我找到的解决方案是在 IE6 中为 ValidationSummary div 添加一个高度。我不确定为什么这只发生在回发时。我认为这与IE6自动扩展错误IE6 bug有关

在您的页面或母版页中添加以下内容以包含 IE6 特定样式表:

<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="../css/system/ie-form.css" />
<![endif]-->

ie-form样式表代码:

.form-error-box {
    height:75px;
}

另一个提示是在 ValidationSummary 控件中添加forecolor="" 以删除 asp.net 默认的红色字体颜色。

【讨论】:

    猜你喜欢
    • 2012-03-25
    • 2012-08-13
    • 1970-01-01
    • 2016-11-08
    • 2010-10-07
    • 2011-03-18
    • 2010-11-24
    • 2011-10-14
    • 1970-01-01
    相关资源
    最近更新 更多