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

DateTimePicker Behaviour

1 Answer 190 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Fabian
Top achievements
Rank 1
Fabian asked on 07 Feb 2012, 12:15 PM
Hello,

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?

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 10 Feb 2012, 11:57 AM
Hello,

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 >>
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Fabian
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or