Sorting records datewise in datatable.
- by Harikrishna
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 ?