0

I have the following GridView in ASP.NET 3.5:

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

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:

<thead>
  <tr>
    <th scope="col"> <!-- No class :( -->
      Date
    </th>
    ...
  </tr>
</thead>
7
  • How is your CSS defined? Commented Dec 17, 2009 at 16:36
  • @Shawn: What do you mean? (I don't see how that could matter anyways?) Commented Dec 17, 2009 at 16:38
  • what is in the css class for "date"? It might give us a clue to why it's not working. Commented Dec 17, 2009 at 16:40
  • It only has a width set. I know it works, because I use it in my currently static tables. Commented Dec 17, 2009 at 16:41
  • Do you have anything else that overrides your css? anything set for generic th or td elements? Commented Dec 17, 2009 at 16:46

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.