This is a migrated thread and some comments may be shown as answers.

RadDateTimePicker Datatime? Databinding

1 Answer 138 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
AndreaT
Top achievements
Rank 1
AndreaT asked on 13 Aug 2008, 01:41 PM
Hello,

weird enought... I found that RadDateTimePicker's Value property is of DateTime type where the corresponding ASP.NET AJAX is the nullable DateTime?

I use DataTime? property in all of my classes and I use DataBindings

RadDateTimePeaker rdp;
rdp.DataBindings.Add("Value", myObj, "MyNullableDataTimeFields");

this obviously fails

if (myObj.MyNullableDateTimeProperty== null
   rdp.SetToNullValue(); 
else 
   rdp.Value = myObj.MyNullableDateTimeProperty.Value; 
 

is quite hugly IMHO.

Any advice?

Thank you
Lorenzo

PS I use RadControls for Winforms Q2 2008

1 Answer, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 14 Aug 2008, 08:26 AM
Hello Lorenzo,

Thank you for contacting us.

I agree with you and we will consider very carefully changing the behavior of the Value property and making it nullable. The code you have written seems to be correct and it is  the only way to check whether the value is null and then set it to NullDate.

If you have any more questions please do not hesitate to write me back.

Greetings,
Boyko Markov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
AndreaT
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Share this question
or