Click to See Complete Forum and Search --> : [RESOLVED] Handle Nullable Date Field with DateTimePicker


kvwarun
July 5th, 2008, 03:27 AM
Dear All,

Which is the best pratice to handle a Nullable Date Field with DateTimePicker control. From my previous experience i learned that we could not show Null in datetimepicker control, i used to fix this problem with IIF function. can anyone help me out to solve this problem in a better way

Warun

dglienna
July 5th, 2008, 10:45 AM
It's been asked:

http://www.codeproject.com/KB/selection/NullableDateTimePicker.aspx

kvwarun
July 8th, 2008, 12:12 AM
Thanks for your suggestion. I solved the same by setting
DateTimePicker1.Format = Custom
DateTimePicker1.CustomFormat = " "

this case your DateTimePicker control shows blank in display, and whenever user select a particular date, i set the custom format to appropriate expression. pressing delete key set the customformat again as " ". so the space we can treat as Null and not space you can consider as datetime value

Warun