RadDateTimePicker Datatime? Databinding

2 posts, 0 answers
  1. AndreaT
    AndreaT avatar
    27 posts
    Member since:
    Sep 2007

    Posted 13 Aug 2008 Link to this post

    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
  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 14 Aug 2008 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top