title: how to enable sorting columns in ASP.NET Gridview control
body: <p>ASPX code. </p>
  
  <pre><code>&lt;asp:GridView ID="gidtest" runat="server" AutoGenerateColumns="False" BackColor="White"
          BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="100%"
          AllowPaging="True" **AllowSorting="True"** 
          OnPageIndexChanging="gidtest_PageIndexChanging"&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="MinistryName" HeaderText="Name" SortExpression="Ministry Name"
                  ItemStyle-Width="40%" &gt;
  &lt;ItemStyle Width="40%"&gt;&lt;/ItemStyle&gt;
              &lt;/asp:BoundField&gt;
          &lt;/Columns&gt;
          &lt;FooterStyle BackColor="#FFFFCC" ForeColor="#330099" /&gt;
          &lt;HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" /&gt;
          &lt;PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" /&gt;
          &lt;PagerSettings FirstPageText="first" LastPageText="last" Mode="NumericFirstLast" PageButtonCount="2"/&gt;
          &lt;RowStyle BackColor="White" ForeColor="#330099" /&gt;
          &lt;SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" /&gt;
          &lt;SortedAscendingCellStyle BackColor="#FEFCEB" /&gt;
          &lt;SortedAscendingHeaderStyle BackColor="#AF0101" /&gt;
          &lt;SortedDescendingCellStyle BackColor="#F6F0C0" /&gt;
          &lt;SortedDescendingHeaderStyle BackColor="#7E0000" /&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>SORTEXpression is not working, any inputs on this</p>