Hi
I am now using Version 2.2.39
With this version you cannot pick the date because the drop down becomes detached from the grid.
On trying again this morning the dropdown now appears where it should unless you click on the arrows to move to a different month.
When you do this the dropdown becomes detached from the grid as in the attached image.
See attached image.
NB you can type the date in ok
I have also noticed that with a bound DGV, if the data source contains DBNull for the date the Date Picker control within the column does not always get set to datetime.MinValue by default
Thanks for your help
Hi Ewan, the “detaching” drop down is fixed. Thanks. It was caused by code for mobile kicking in by mistake. About the DBNull issue, DBNull is not converted to DateTime.MinValue, it stays DBNull. The issue could be that when you edit with the DateTimePicker and make it black it stores DateTime.MinValue and should be converted back to DBNull?
Having investigated this further.
The datetime column picks up the correct values for MinValue ie 01/01/1753 from the binding source
The editing control, however defaults to a MinValue of 01/01/0001.
The MinValue of 01/01/0001 is what gets passed back to the server when a new row is added and the date has not been edited
When you edit an existing row either Null or 01/01/0001 is passed back if the date has not been edited (presumably depending on the browser /browser settings)
Having read
#2585 | DataGridViewDateTimePickerColumn.DefaultCellStyle incorrectly sets the DataSourceNullValue to DateTime.MinValue. Should be DBNull. |
I tried setting this in code, however when you start to populate a new row you get the attached error
dgv.Columns[3].DefaultCellStyle.DataSourceNullValue = DBNull.Value;
Thanks for your help
Hi Luca
Thanks. I handle DateTime.MinValue by passing a text value as its not a valid SQL date, however there seems to be an inconsistency as some of the time the MinValue is passed and at other times null is passed. (I am capturing the parameter values passed to the SP that updates the SQL table for debugging purposes)
Thanks for your help
Please login first to submit.