Question

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

Was it helpful?

Solution

The solution I found is to add a height to the ValidationSummary div in IE6. I am not sure why this only happens on postback. I think it has something to do with the IE6 auto-expansion bug IE6 bug

Add the following in your page or masterpag to include an IE6 specific stylesheet:

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

ie-form stylesheet code:

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

another tip is to add forecolor="" to the ValidationSummary control to remove asp.net default red font color.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top