Datagrid style is screwed on IIS 6

Jon Winterburn
Jon Winterburn used Ask the Experts™
Hi experts,

I have a really irritating CSS/datagrid problem. I am developing an ASP.NET page in VB.NET on XP SP3 with VS.NET 2005. When I view the page on my machine, the datagrid looks perfect (see attachment 1). But when I copy the EXACT files to the production server (Windows Server 2003 standard, SP2) the datagrid looks ugly (thicker grey lines) and the header breaks (see attachment 2). I am viewing both in IE8 on the same machine.

Why is this happening?! Is there something about IIS6 that displays datagrids differently to IIS5?


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IIS won't effect the CSS or rendering of the datagrid, it just serves the files. The .Net framework will compile and generate the markup.

I wonder if it is caching the CSS file - maybe you are seeing a previous version. Is the CSS in a separate file - try deleting it, should see no style.

Unless you are styling it all inline in the code.


I have removed my custom CSS and left the datagrid as such:

asp:datagrid ID="dgCurrYear" runat="server" AutoGenerateColumns="False" CellPadding="3" ForeColor="#333333" Width="300" style="border-collapse:collapse"

But yet, the ugly gridlines are there, rather than the clean, thinner, lighter ones.


I have just discovered something else. If I visit my own local machine from another machine, the datagrid looks broken! So it would appear that if I view it locally, it looks like I expect it to, but if I visit it remotely, the formatting is screwed. I have confirmed this by putting a copy of the site on another machine and performing the same tests.

Is there a setting in IIS or .NET that is causing this to happen?
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

That sounds very odd.

So what happens if you make the border colour red for example - what do you see local and remote?
Found it! Bloody IE8 compatibility mode was set to on for Intranet sites. As soon as I turned this off, it works fine. Very strange.
Crikey what a pain. I didn't know it could be set depending on network type. Well I'm glad you found the problem that's a tough one to learn :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial