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

Avoid default today

1 Answer 44 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Arnold
Top achievements
Rank 1
Arnold asked on 13 Sep 2017, 08:33 AM

I have an issue with the DateTimePicker.
I'm using this control mainly for keyboard entry.
I live in The Netherlands and our date format is "dd-mm-yyyy".

The issue is as follows: 
If the current month has less than 31 days (like this month september for example), we are not able to enter a date that starts with 31 (like 31-08-2017).
This happens because as soon as I start typing, todays date appears in the editor. This means the day is validated as a day in the month september.
We would have to change the month first, than move back to the day portion and correct it. But, as you would admit, this is unnecessary cumbersome.

Is it possible to not have a default date appear as soon as the user starts typing?
If not, is it possible to have a default date like 01-01-2017 when the user starts typing?

Tnx for your help

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 13 Sep 2017, 12:53 PM
Hello Arnold,

Thank you for writing.

The observed behavior follows the behavior of the standard .NET DateTimePicker control. Typing in the editor also results in changing the selected date in the calendar. In order to achieve your task, I can suggest using the Free From Date Time Parser: http://docs.telerik.com/devtools/winforms/editors/datetimepicker/free-form-date-time-parsing

Please check my code snippet below: 
CultureInfo culture = new CultureInfo("nl-NL");
this.radDateTimePicker1.Culture = culture;
this.radDateTimePicker1.DateTimePickerElement.Calendar.Culture = culture;
this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.MaskType = MaskType.FreeFormDateTime;

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Arnold
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or