Need editable option without clicking arrow keys

4 posts, 0 answers
  1. jaya
    jaya avatar
    4 posts
    Member since:
    Sep 2018

    Posted 18 Oct 2018 Link to this post

    In RadDatetimepicker, need an editable option for all DD/MM/YYYY without clicking any arrow keys. Eg: If I’m once I enter the date it should automatically move to the month and year.
  2. Dimitar
    Admin
    Dimitar avatar
    2714 posts

    Posted 19 Oct 2018 Link to this post

    Hi Jaya,

    This is can be achieved by setting the following property:
    var provider = radDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider as MaskDateTimeProvider;
    provider.AutoSelectNextPart = true;

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. jaya
    jaya avatar
    4 posts
    Member since:
    Sep 2018

    Posted 23 Nov 2018 in reply to Dimitar Link to this post

    Hello Dimitar,

    Thank you for the suggested solution it works nicely,But the auto selection function should stop on the year & should not move to the day/month field. Please suggest any method.

  4. Hristo
    Admin
    Hristo avatar
    1507 posts

    Posted 26 Nov 2018 Link to this post

    Hello Jaya,

    You can create a custom MaskDateTimeProvider and override its SelectFirstItem not calling the base implementation: 
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
    {
        public RadForm1()
        {
            InitializeComponent();
     
            this.radDateTimePicker1.Format = DateTimePickerFormat.Custom;
            this.radDateTimePicker1.CustomFormat = "dd/M/yyyy";
             
            MyMaskDateTimeProvider provider = new MyMaskDateTimeProvider(this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.Mask, this.radDateTimePicker1.Culture, this.radDateTimePicker1.DateTimePickerElement.TextBoxElement);
            provider.AutoSelectNextPart = true;
            this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider = provider;
        }
    }
     
    public class MyMaskDateTimeProvider : MaskDateTimeProvider
    {
        public MyMaskDateTimeProvider(string mask, CultureInfo culture, RadMaskedEditBoxElement owner)
            : base(mask, culture, owner)
        {
        }
     
        public override void SelectFirstItem()
        {
            //base.SelectFirstItem();
        }
    }

    I hope this will help. Let me know if you need further assistance.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top