DateTimePicker Behaviour

2 posts, 0 answers
  1. Fabian
    Fabian avatar
    5 posts
    Member since:
    Sep 2010

    Posted 07 Feb 2012 Link to this post


    I have some issues with the behavoiur of the RadDateTimePicker which confuses me alot.
    We are using the 2011.3.11.1219 Version of Telerik.

    When I load a form I have an initial value which can be a DateTime or can be null. If the value is null the DateTimePicker on the should display a string lilke "No Value", if you click on the DateTimePicker to specify a Date or if you click on the DropDown Button, the current Day should be preselected. If the initial value is not null the DateTime should be displayed immediately if the form is shown.

    If the value is null I have tried the following:

     rdtp.NullText = "No Value";
     rdtp.NullableValue = null;

    Now I have tried to use various combination of the Properties but all the time I get the same result. If you click on the DTP or press the DropDown Button either the minDate is selected or (if not set) 01.01.0001 is selected in the calendar. I have tried to set the value of the DTP to DateTime.Now or setting the NullDate and use the SetToNullValue(); but no matter what the Value will never change and remain as it was (minDate or 01.01.0001).

    How can I achieve the desired behaviour?
  2. Peter
    Peter avatar
    1160 posts

    Posted 10 Feb 2012 Link to this post


    Thank you for writing.

    You should set the Value to DatTime.Now before seting the NullableValue to Null:

    this.radDateTimePicker1.Value = DateTime.Now;
    this.radDateTimePicker1.NullText = "No Value";
    this.radDateTimePicker1.NullableValue = null;

    Please refer to radDateTimePicker1 in the attached sample project.
    I hope this helps. Do not hesitate to contact us if you have other questions.

    Greetings, Peter
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top