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

4 posts, 0 answers
  1. Philip
    Philip avatar
    7 posts
    Member since:
    Sep 2012

    Posted 07 Aug 2013 Link to this post

    #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?

  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 12 Aug 2013 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tom
    Tom avatar
    4 posts
    Member since:
    Feb 2013

    Posted 22 Oct 2013 Link to this post

    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
  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 25 Oct 2013 Link to this post

    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 >>
Back to Top