With the DateTimePicker, I can bind a nullable DateTime property to NullableValue:
resolvedDateTimePicker.DataBindings.Add(
"NullableValue"
, _bindingSource,
"DateResolved"
,
true
, DataSourceUpdateMode.OnPropertyChanged);
Unfortunately the NullableValue property doesn't seem to exist for the TimePicker.
Will this be implemented at some point, and/or how would I bind a DateTimePicker to a nullable DateTime?
4 Answers, 1 is accepted
With the DateTimePicker, I can bind a nullable DateTime property to NullableValue:
resolvedDateTimePicker.DataBindings.Add(
"NullableValue"
, _bindingSource,
"DateResolved"
,
true
, DataSourceUpdateMode.OnPropertyChanged);
Unfortunately the NullableValue property doesn't seem to exist for the TimePicker.
Will this be implemented at some point, and/or how would I bind a DateTimePicker to a nullable DateTime?
[/quote]
Sorry, should be:
Will this be implemented at some point, and/or how would I bind a TimePicker to a nullable DateTime?
The RadTimePicker already supports this. Its Value property type is nullable DateTime and you can directly set it to null:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
radTimePicker1.Value =
null
;
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
Hi Dimitar,
Thanks for the response, that works great.
It wasn't initially working because I was setting the "formattingEnabled" parameter to false when I was adding the DataBindings. So I thought that, like the DateTimePicker, you couldn't bind to Value if your DataTime was nullable. It's a little confusing that they work differently, but it's all good now, thanks.
Yes, indeed it's a bit confusing, with RadDateTimePicker this was added as a later point and this is why there is another property. Nevertheless, I am glad that his works as expected now and do not hesitate to contact us if you have other questions.
Regards,
Dimitar
Progress Telerik