开发者

ASP.NET/GridView: HeaderStyle-CssClass has no effect

I have the following GridView in ASP.NET 3.5:

<asp:GridView ID="gvTable" runat="server开发者_StackOverflow社区" 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>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜