Sorting TemplateField when a boundfield is sorted in a Gridview Control
<p>I would like to know how can i sort a templateField when i'm actually sorting a Boundfield in a GridView control. Technology used is ASP.NET.</p>

<p>Here is my code : </p>

<pre><code>&lt;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"&gt;
    &lt;Columns &gt;
        &lt;asp:TemplateField&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:Button Text = "Supprimer" runat="server" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' CommandName="Del" CausesValidation="false"/&gt;
                &lt;asp:Button Text = "Editer" runat="server" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' CommandName="Maj"  CausesValidation="false" /&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;asp:BoundField  DataField="name" HeaderStyle-BorderStyle="Outset" HeaderText="Nom de la classe" ItemStyle-HorizontalAlign="Center" SortExpression="name"/&gt;
        &lt;asp:BoundField DataField="NbEtu" ReadOnly="true" HeaderText="Nb Etudiant actuel" ItemStyle-HorizontalAlign="Center"/&gt;
        &lt;asp:BoundField DataField="minEtu" HeaderText="Nb Etudiant Min" ItemStyle-HorizontalAlign="Center" /&gt;
        &lt;asp:BoundField DataField="maxEtu" HeaderText="Nb Etudiant Max" ItemStyle-HorizontalAlign="Center" /&gt; 
    &lt;/Columns&gt; 
&lt;/asp:GridView&gt;
</code></pre>

<p>Thanks in advance,</p>

<p>Best regards</p>
