Datetime sorting in the gridview
<p>here i sort the datetime using this code</p>

<pre><code>var query = from a in PurchaseRequestDetails.Tables[0].AsEnumerable()

orderby DateTime.Parse(a.Field&lt;string&gt;("RequiredDate")) // this will sort ur data according to datetime

select a;

DataView view = PurchaseRequestDetails.Tables[0].AsDataView();

view.Sort = "RequiredDate";

dgvPurReq.DataSource = view;

dgvPurReq.DataBind();
</code></pre>

<p>Note:Here 'RequiredDate' is varchar in the database</p>

<p>i am getting a output like this:</p>

<ul>
<li><p>01-Aug-2010</p></li>
<li><p>03-Aug-2010</p></li>
<li><p>06-Aug-2010</p></li>
<li><p>23-Jun-2010</p></li>
</ul>

<p>'Jun' should come before the 'aug' sorting should be done in the month and even in the year also.</p>
