LarrySteele
Programmer
I'm using CSS to set padding for TH and TD elements and it works as advertised. One of the attributes is padding ([tt]padding: 0 1em 0 .25em;[/tt]). This adds a touch of whitespace before and after the text. I'm happy with pretty much all my tables, gridviews, etc.
But there's one. Among other data, this one has seven columns representing days of the week. The TH's are filled with one letter for the weekday and the TD's are filled with a checkbox. In these columns, I don't want the padding around the checkbox.
I thought I could us CssClass to override the style and even tried inline style to override. No effect on either.
I've worked with a number of suggestions I found via Google, but nothing I tried worked - though I did find a couple of ways to really foul things up. I searched Tek-Tips, but didn't find anything I could use.
Here's my ASP snippet for the column I'm working with.
Here are a couple of methods I've tried to override the style. The text in red were two methods I tried (first setting inline style only, then setting the ItemStyle-Width only, then both).
This isn't a question about CSS, but how to override it on specific columns in a GridView. Nevertheless, I'll post the relevant CSS here. The GridView class is the CssClass I apply on the asp:GridView object.
Any suggestions on how to override the CSS applied to just these columns would be appreciated.
But there's one. Among other data, this one has seven columns representing days of the week. The TH's are filled with one letter for the weekday and the TD's are filled with a checkbox. In these columns, I don't want the padding around the checkbox.
I thought I could us CssClass to override the style and even tried inline style to override. No effect on either.
I've worked with a number of suggestions I found via Google, but nothing I tried worked - though I did find a couple of ways to really foul things up. I searched Tek-Tips, but didn't find anything I could use.
Here's my ASP snippet for the column I'm working with.
Code:
<asp:TemplateField HeaderText="S">
<ItemTemplate>
<asp:CheckBox ID="ChkSun" runat="server" Checked='<%# Eval("sun").ToString() == "Y" ? true : false %>' />
</ItemTemplate>
</asp:TemplateField>
Here are a couple of methods I've tried to override the style. The text in red were two methods I tried (first setting inline style only, then setting the ItemStyle-Width only, then both).
Code:
<asp:TemplateField HeaderText="S" [COLOR=#EF2929]ItemStyle-Width="10px"[/color]>
<ItemTemplate>
<asp:CheckBox ID="ChkSun" runat="server" [COLOR=#EF2929]style="padding: 0;"[/color] Checked='<%# Eval("sun").ToString() == "Y" ? true : false %>' />
</ItemTemplate>
</asp:TemplateField>
This isn't a question about CSS, but how to override it on specific columns in a GridView. Nevertheless, I'll post the relevant CSS here. The GridView class is the CssClass I apply on the asp:GridView object.
Code:
.GridView tr th
{
border: 1px solid #06c;
color: White;
padding: 0 .25em 0 .25em;
}
.GridView tr td
{
border: 1px solid #06c;
color: #222;
padding: 0 1em 0 .25em;
}
Any suggestions on how to override the CSS applied to just these columns would be appreciated.