title: How to sort the date column in gridview?
body: <p>I am using ASP.NET and C#.This is my code.</p>
  
  <pre><code>    private const string ASCENDING = "ASC"; 
      private const string DESCENDING = "DESC";
      public SortDirection GridViewSortDirection 
      {     
          get     
          {         
              if (ViewState["sortDirection"] == null)             
                  ViewState["sortDirection"] = SortDirection.Ascending;          
              return (SortDirection) ViewState["sortDirection"];                     
          }     
          set { ViewState["sortDirection"] = value; }  
      }
  
      public string SortExpression
      {
          get
          {
              if (ViewState["sortExpression"] == null)
                  ViewState["sortExpression"] = "JobNumber";
              return ViewState["sortExpression"] as string;
          }
          set { ViewState["sortExpression"] = value; }
      }
      protected void OnSorting(object sender, GridViewSortEventArgs e)
      {
              SortExpression = e.SortExpression;
              if (GridViewSortDirection == SortDirection.Ascending)
              {
                  GridViewSortDirection = SortDirection.Descending;
              }
              else
              {
                  GridViewSortDirection = SortDirection.Ascending;
              }
              BindGrid();
      }
  </code></pre>
  
  <p>I am applying sorting for all the columns and working fine. But with date column it is like in this order(dd/mm/yyyy).</p>
  
  <ul>
  <li>30/11/2012</li>
  <li>10/12/2012</li>
  <li><p>9/10/2012</p>
  
  <pre><code>&lt;asp:BoundField DataField="ReportedDate" HeaderText="Reported Date" SortExpression="ReportedDate" DataFormatString="{0:DD/MM/YYYY}" HtmlEncode="false" /&gt;
  </code></pre></li>
  </ul>
  
  <p>the datatype of this column is date.</p>
  
  <p>How to do this?Am i doing wrong?</p>