title: Sorting in ASP.NET Gridview
body: <p>Its Arun. This time I have a sorting issue in ASP.Net. For the first click, descending is working fine but on the second click ascending is not taken again. Its still in the descending order. I m using Tableadapter to display the gridview content. Please review the code and correct me where I ve missed.</p>
  
  <pre><code>    protected void gv1_Sorting(object sender, GridViewSortEventArgs e)
      {
          string sdir = e.SortDirection == SortDirection.Ascending ? "DESC" : "ASC";
          DataView dv = new DataView(ds2.AllocationPending(ClientLoggedIn.Text));
          dv.Sort = e.SortExpression + " " + sdir;
          gv1.DataSource = dv;
          gv1.DataBind();
      }
  </code></pre>
  
  <p>Also please explain - Is there any other way to apply sorting without Dataview. </p>
  
  <p>Thank you .</p>