When a FlexGrid is bound to a DataTable containing DateTime columns, the grid uses a default editor that does not provide an intuitive way for users to clear a selected date or set the value back to null. This can be a significant limitation when users need to remove data without deleting the entire row.
Solution
The most efficient way to allow users to clear date values is to replace the default editor with the DateEdit control from the C1.Win.C1Input assembly. This control is fully compatible with FlexGrid and includes a built-in "Clear" button within its dropdown calendar. By assigning a C1DateEdit instance to the Editor property of your DateTime column, you enable null values without the need for manual event handling like AfterEdit or complex key-down logic.
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Joining", typeof(DateTime));
for (int i = 1; i < 10; i++)
{
dt.Rows.Add(i, $"Name {i}", DateTime.Now);
}
//assign data
c1FlexGrid1.DataSource = dt;
//use custom editor
c1FlexGrid1.Cols["Joining"].Editor = new C1DateEdit();