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

No Null Value Allowed

1 Answer 52 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Phillip
Top achievements
Rank 1
Phillip asked on 13 Jun 2016, 11:44 AM

Hallo everyone,

how about a Property for the DateTimePicker that can switch on(true) / off (false) for writing in null values. In my case, I don't/can't set the InputField to disable but the user should not be allowed to set the date to null. It would be awesome if the Picker sets its own value automatically to the last valid value by loosing the focus. if there is in the beginning no value in the field its automatically set to the date of today.

 

I mean something like the winforms feature:

datePicker.NullDate = ...

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 15 Jun 2016, 10:13 AM
Hello Phillip,

We consider setting the Value of the DateTimePicker to a previous valid Value as more of application logic that should be handled according to the specific scenario.
You could implement validation in the ViewModel with the IDataErrorInfo interface as demonstrated in the DateTimlePicker Data Validation example inside WPF Demos or you could just check the SelectedValue and preserve the last valid value in some variable that can be used in case SelectedValue is null.

Regards,
Yana
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
DateTimePicker
Asked by
Phillip
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or