ASP.NET 4 GridView在排序和绑定通用列表时不显示箭头

ASP.NET 4 GridView在排序和绑定通用列表时不显示箭头,asp.net,sorting,gridview,Asp.net,Sorting,Gridview,我的问题是:如何使GridView在排序和绑定通用列表时显示箭头 我正在测试ASP.NET中的新属性,以便在这个博客条目之后在GridView中进行排序时显示箭头 我的aspx标记是这样的 <asp:GridView ID="GridView2" runat="server" AllowSorting="true" CssClass="gridView" ... <SortedAscendingCellStyle BackColor="#F5F7FB" /> &

我的问题是:如何使GridView在排序和绑定通用列表时显示箭头

我正在测试ASP.NET中的新属性,以便在这个博客条目之后在GridView中进行排序时显示箭头

我的aspx标记是这样的

<asp:GridView ID="GridView2" runat="server" AllowSorting="true" CssClass="gridView"
...
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" CssClass="SortedAscending" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="SortedDescending" />
...
</asp:GridView>
我在这里看到的重要一点是class=sortedastending。这是我为aspx页面的SortedAscendingHeaderStyle属性指定的名称

我的问题是,我的BLL返回通用列表,当我将它们绑定到GridView时,它会生成类似以下HTML标记的内容

 &lt;th style="background-color: rgb(109, 149, 225);" scope="col" class="SortedAscending"&gt;&lt;a style="color: White;" href="javascript:__doPostBack('ctl00$MainContent$GridView3','Sort$Name')"&gt;Name&lt;/a&gt;&lt;/th&gt;
&lt;th scope="col"&gt;&lt;a style="color: White;" href="javascript:__doPostBack('ctl00$MainContent$GridView2','Sort$Name')"&gt;Name&lt;/a&gt;&lt;/th&gt;

在这个标记中,我缺少class=SortedAscending,这就是为什么我在GridView中获取箭头时遇到问题。

检查这里。这项技术可以帮助您在列标题中显示箭头。

要清楚:1。你的分拣工作正常吗?2.您只是想让标题正确显示吗?@mjwills:排序标题有效,但不显示箭头。