Take the 2-minute tour ×

I have the following GridView in ASP.NET 3.5:

<asp:GridView ID="gvTable" runat="server" AllowSorting="true" ShowHeader="true">
    <asp:BoundField DataField="ActivityDate" HeaderText="Date"
      HeaderStyle-CssClass="date" />
    <asp:BoundField DataField="ActivityType" HeaderText="Type" />
    <asp:BoundField DataField="ActivityNotes" HeaderText="Notes" />
  <PagerSettings Position="Bottom" Mode="NextPrevious" PageButtonCount="5"
    PreviousPageText="Older activities" NextPageText="Newer activities" />

What I'm trying to do is have the first cell of the <thead> of the table to have the CSS class "date". However, it seems to have no effect whatsoever. If I use ItemStyle-CssClass, it does have the wanted effect, but applies to all of the body cells as well.

What am I doing wrong?

The HTML it gives me looks like this:

    <th scope="col"> <!-- No class :( -->
share|improve this question
How is your CSS defined? –  Shawn Steward Dec 17 '09 at 16:36
@Shawn: What do you mean? (I don't see how that could matter anyways?) –  Deniz Dogan Dec 17 '09 at 16:38
what is in the css class for "date"? It might give us a clue to why it's not working. –  adrianos Dec 17 '09 at 16:40
It only has a width set. I know it works, because I use it in my currently static tables. –  Deniz Dogan Dec 17 '09 at 16:41
Do you have anything else that overrides your css? anything set for generic th or td elements? –  adrianos Dec 17 '09 at 16:46
show 2 more comments

1 Answer

up vote 1 down vote accepted

The problem was that I was using an outdated version of the CSS Friendly Control Adapters. Downloaded the latest source, compiled, used the new DLL and .browser file and that fixed it.

share|improve this answer
add comment

Your Answer


