1

I am posting back to the server to check the DB to see if we hold a reference number. If the reference number does not exist I set two custom validators to invalid and change the ValidationSummary header text. The problem is that the background colour I set in the css class does not display. The font colour does display correctly.

When the validation summary is displayed using client side script the styles are displayed correctly. i am not sure why they dont when there is a post back.

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;
}

code

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

This works in Firefox and IE 8 on post but not IE 6. Unfortunatly I have to support IE 6

4

1 回答 1

0

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

在您的页面或母版页中添加以下内容以包含 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;
}

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

于 2010-11-17T11:06:29.413 回答