如果我单击名为Days的列标题,则希望根据数值从低到高的顺序对数据进行排序(升序时),反之亦然,但它不能正常工作,例如当数据是7,18,7,33,28,35,21,7,27,7,48排序为11,7,14,24,34,12,24,28,11,13,55我尝试将dataformatstring设置为数值,并且查询返回一个整数,但仍然无法正常工作。
<asp:GridView ID="rgList" runat="server" AllowFilteringByColumn="True" EnableViewState="False"
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="MAID"
PageSize="50"
DataSourceID="odsList" GridLines="None"
OnRowCommand="rgList_RowCommand" OnRowDataBound="rgList_RowDataBound"
ShowFooter="False" Width="100%" CssClass="table table-hover table-striped table-bordered GridViewHeader tableCompact">
<PagerStyle CssClass="pagination-mh"></PagerStyle>
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="50" HeaderText="Days" SortExpression="DayOfApproved">
<ItemTemplate>
<asp:Label ID="lblDayOfApproved" Font-Size="8" runat="server" CausesValidation="False" CssClass="badge badge-pill badge-danger" Text='<%# Bind("DayOfApproved")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>