private void dataGridView1_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
{
e.SortResult = System.String.Compare(
e.CellValue1.ToString(), e.CellValue2.ToString()); // If the cells are equal, sort based on the column.
if (e.SortResult == 0 && e.Column.Name != "DateofJoining")
{
e.SortResult = System.String.Compare(
dataGridView1.Rows[e.RowIndex1].Cells["DateofJoining"].Value.ToString(),
dataGridView1.Rows[e.RowIndex2].Cells["DateofJoining"].Value.ToString());
}
e.Handled = true;
}
}
}
I have made virtual mode as false and sort mode as programmatic.
Thanx in advance........
if u want to share some another technique for the same...then urs welcome.......