Sorting records datewise in datatable.
Posted
by Harikrishna
on Stack Overflow
See other posts from Stack Overflow
or by Harikrishna
Published on 2010-05-04T10:11:19Z
Indexed on
2010/05/04
10:28 UTC
Read the original article
Hit count: 175
I have datatable and I am storing the records in that datatable. Now one of the column in the datatable is type of DateTime.That column I added by code
Table.Columns.Add(new DataColumn("TradingDate",System.Type.GetType("System.DateTime")));
Now I want to sort the records datewise in ascending order. I have used following code but the records are not sorted.
DataView view = new DataView(Table);
view.Sort = "TradingDate ASC";
dataGridView1.DataSource=view.Table;
But records are not sorted so how to do it ?
© Stack Overflow or respective owner