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

need radDateTimePicker to accept any input so I can parse into valid date

3 Answers 42 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 07 Aug 2013, 01:44 PM
#1
How can I configure radDateTimePicker to allow any type of input so I can parse the input into a valid date (or set to null if invalid)?

Examples:

- Users want to be able to key in 7 (today's day part) and have the date parsing assume current month and year => 08/07/2013;

- Key in 9/7 ... date parsing will assume current year => 09/07/2013;

I will write the parsing rules ... but how can I configure the control to accept text only ... without the '/' and without trying to format as a date while the user is typing?


#2
How can I make the control (and all other Telerik controls) look like the rest of the controls on my form?  I am using Win7 ... but others may be on Win8 or Vista.

#3
How can I make the control not nullable - so a date must be entered?

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Aug 2013, 10:07 AM
Hello Philip,

Thank you for contacting Telerik Support.

#1
RadDateTimePicker by default allows the user to select a part of the Date (day/month/year) and change its value by keypress (enter a number). The inside TextBoxElement containes a MaskDateTimeProvider composed of 9 parts. Its SelectedItemIndex indicates which part of the date to be selected. It is not supported to change the default date parsing. You are allowed to navigate the selected index. You may subscribe to GotFocus event and change the index of the MaskDateTimeProvider part when the control is focused. Note that SelectedItemIndex=3 corresponds to Month part, SelectedItemIndex=5 corresponds to Day part:
private void radDateTimePicker1_GotFocus(object sender, EventArgs e)
       {
           RadMaskedEditBoxElement mask = sender as RadMaskedEditBoxElement;
           MaskDateTimeProvider provider = mask.Provider as MaskDateTimeProvider;
           provider.SelectedItemIndex = 5;
       }

The control does not allow any input different from a valid DateType. We have a feature request logged in our Public Issue Tracking System - PITS for Date Parsing custom input control. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - PITS issue.

#2
For uniform view of the entire application you need to set ApplicationThemeName.

#3
If you want to prevent the user to clear the date by Clear button in calendar footer you may use:
RadDateTimePickerCalendar calendarBehavior = this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as      RadDateTimePickerCalendar;
RadCalendar calendar = calendarBehavior.Calendar as RadCalendar;
calendar.ShowFooter = true;
calendar.ClearButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Tom
Top achievements
Rank 1
answered on 22 Oct 2013, 03:28 PM
I would encourage everyone to vote for this issue to be fixed.  It just does not make sense to have to train users to enter dates differently whether it is a .Net control or a Telerik control.  They certainly do not know the difference.

http://www.telerik.com/support/pits.aspx#/details/Issue=1081
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 Oct 2013, 11:55 AM
Hello Tom,

Thank you for contacting us again,

One of the key points that we are taking into consideration when we prioritize the issues/feature requests that our users report is how many users have voted for a PITS item. If more customers vote for it, we will increase its priority.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Philip
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Tom
Top achievements
Rank 1
Share this question
or