CSS style lost on validation in ASP.NET, ie onlyApril 14, 2011
In the process of upgrading the style of an existing ASP.NET web application I incorporated the 960.gs grid system style sheets. Along the way I created a single style sheet with 4 @import directives, so I didn’t have this list of CSS files on every page, just one <link href…> tag that included a single CSS file with the @imports.
During testing it was uncovered that while using the app in IE 7, when a validator failed and generated a message (like “Bad email address” etc) during the postback process a large majority of the style on the page would be absent – making it look pretty bad.
Turns out the problem is the @import directives not being obeyed during the 2nd rendering of the page.
I moved all the CSS into a single file (which will help with performance in the long run) and the problem goes away.