I've created a DataTable as follows:
accTable = new DataTable();
accTable.Columns.Add(new DataColumn("Date"));
accTable.Columns.Add(new DataColumn("Amt"));
accTable.Columns.Add(new DataColumn("Item"));
and filling it by:
foreach (DataRow myDataRow in myDataSet.Tables[0].Rows)
{
DataRow accRow = accTable.NewRow();
//code skipped
accRow["Date"] = date.ToString("d"); //tried without converting to string also
accRow["Amt"] = int.Parse(cells[1].ToString());
accRow["Item"] = cells[2].ToString();
accTable.Rows.Add(accRow);
}
Then I'm binding a DataGridView to the DataTable accTable as follows:
dataGridView1.DataSource = accTable;
How can I make the Date column sortable. By default, it is sorting alphabetically. Where can I set the type of the column to DateTime.