Reputation: 12309
A page in our application uses a GridView for displaying -- which gets emitted as a table. We prefer to leave off the borders, so these are coded to be suppressed. See this code:
<asp:GridView CssClass="detail" AutoGenerateColumns="false" UseAccessibleHeader="true" RowStyle-CssClass="detail_data" BorderWidth="0" HeaderStyle-CssClass="detail_label" runat="server" ID="RiembursementRequestGrid">
<Columns>
<asp:BoundField HeaderStyle-Wrap="false" HeaderText="RR Id" DataField="RR ID" />
<asp:BoundField HeaderText="Official Station" DataField="Official Station" />
<asp:BoundField HeaderText="Official Residence" DataField="Official Residence" />
<asp:BoundField ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderText="Description" DataField="Description" />
<asp:BoundField HeaderText="Routing Status" DataField="Routing Status" />
<asp:BoundField HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderText="Amount Requested" DataField="Amount Requested" DataFormatString="{0:c}" HtmlEncode="false" />
<asp:BoundField HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderText="Taxable Amount" DataField="Taxable Amount" DataFormatString="{0:c}" HtmlEncode="false" />
<asp:BoundField HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderText="Travel Advance" DataField="Travel Advance" DataFormatString="{0:c}" HtmlEncode="false" />
</Columns>
</asp:GridView>
The relevant CSS class items are:
.detail
{
border: none;
width: 100%;
font-weight: bold;
text-align: center;
font-family: "Arial";
empty-cells: show;
border-collapse: collapse;
}
.detail_data
{
border: none;
text-align: center;
font-size: small;
font-weight: normal;
border-collapse: collapse;
}
.detail_label
{
border: none;
text-align: center;
font-size: small;
font-weight: bold;
border-collapse: collapse;
}
There is a difference between what's emitted by the workstation vs that emitted by the server.
On my dev workstation, which is Win7 running IIS7.5, the borders are properly absent. On the Win2003 server, running IIS6, the borders are present. This is with the exact same code and CSS, and the same browser viewing it. Here's comparison screenshots:
There is a difference in the code that's being emitted. Here's the HTML code for the table opening tag on the workstation running IIS7.5 :
<table class="detail" cellspacing="0" rules="all" border="0" id="RiembursementRequestGrid" style="border-width:0px;border-collapse:collapse;">
And on the server running IIS6
<table class="detail" cellspacing="0" rules="all" id="RiembursementRequestGrid" style="border-width:0px;border-collapse:collapse;">
As you can see, the only difference is that one tag omits border="0". And for that one the border is truly missing. I would have thought that "border-width: 0" would have covered that particular base, however.
Note that besides the opening table tags all other emitted HTML (except viewstate value) is identical.
The questions are:
Upvotes: 0
Views: 642
Reputation: 78
Have you experimented with the controlRenderingCompatibilityVersion
setting in web.config?
If it's set to 3.5 or higher, border values will be omitted on table
, image
, and imagebutton
tags.
Details here: http://www.asp.net/whitepapers/aspnet4/breaking-changes
Upvotes: 1