Nullable GridDateTimeColumn?

Hi,

I am having trouble getting 'null' values to work in a data grid. The grid is bound to a DataTable as described here:

One of the columns is defined as a DateTime column:
DataTableCollection.Columns.Add("Test Date", typeof(DateTime));

This works if I put values into the table, but if I attempt to use a null I cannot then click to edit the cell. When I click on the cell nothing happens. I have tried using DateTime? but then I get a runtime error stating that the column type cannot be nullable.

Is there an alternative approach I can try to get a DateTime column working with nulls?

Best Regards,

1 Reply

KK Karthikraja Kalaimani Syncfusion Team May 8, 2020 12:47 PM UTC

Hi Kevin,

Your requirement can be achieved by using ObservableCollection instead of DataTable. We have prepared sample for the same.

Sample link :  https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridSample1373350445-1231098592.zip

Regards,
Karthik Raja 


Loader.
Up arrow icon