我想知道当我实际在GridView控件中对Boundfield进行排序时,如何对templateField进行排序。使用的技术是ASP.NET。
这是我的代码:
<asp:GridView ID="classGrid" BorderStyle="Solid"
runat="server" AllowSorting="true" AlternatingRowStyle-BackColor="Azure" AllowPaging="true" OnSorting="onSorting" EnableViewState="true"
ShowFooter="True" ShowHeaderWhenEmpty="true" OnRowCommand="onRowCommand"
EmptyDataRowStyle-HorizontalAlign="Center" EmptyDataText="No datas available" AutoGenerateColumns="false"
SelectedRowStyle-ForeColor="#FF6600" SelectedRowStyle-BackColor="#FF9966" HeaderStyle-BackColor="#9999FF">
<Columns >
<asp:TemplateField>
<ItemTemplate>
<asp:Button Text = "Supprimer" runat="server" CommandArgument='<%# Container.DataItemIndex %>' CommandName="Del" CausesValidation="false"/>
<asp:Button Text = "Editer" runat="server" CommandArgument='<%# Container.DataItemIndex %>' CommandName="Maj" CausesValidation="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="name" HeaderStyle-BorderStyle="Outset" HeaderText="Nom de la classe" ItemStyle-HorizontalAlign="Center" SortExpression="name"/>
<asp:BoundField DataField="NbEtu" ReadOnly="true" HeaderText="Nb Etudiant actuel" ItemStyle-HorizontalAlign="Center"/>
<asp:BoundField DataField="minEtu" HeaderText="Nb Etudiant Min" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="maxEtu" HeaderText="Nb Etudiant Max" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
提前致谢,
祝你好运