Completed
Last Updated: 20 Jul 2021 11:05 by ADMIN
Release R3 2021
Ketan
Created on: 21 Jun 2021 12:18
Category: TimePicker
Type: Bug Report
0
RadTimePicker: After paste opening editor causes text set to 23:59
The calendar selection is not synced with the value after a paste operation.
Attached Files:
1 comment
ADMIN
Nadya | Tech Support Engineer
Posted on: 21 Jun 2021 12:40

Hello, Ketan,

You can use the following workaround:

public class CustomTimpePicker : RadTimePicker
{
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadTimePicker).FullName;
        }
    }

    protected override RadTimePickerElement CreateTimePickerElement()
    {
        return new CustomRadTimePickerElement();
    }
}

public class CustomRadTimePickerElement : RadTimePickerElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadTimePickerElement);
        }
    }
    public override object Value
    {
        get
        {

            return base.Value;

        }

        set
        {
            if (value != null && value != DBNull.Value)
            {
                FieldInfo fi = typeof(RadTimePickerElement).GetField("editBox", BindingFlags.Instance | BindingFlags.NonPublic);
                RadMaskedEditBoxElement editBox = (RadMaskedEditBoxElement)fi.GetValue(this);
                PropertyInfo info = editBox.GetType().GetProperty("MaxDate", BindingFlags.Instance | BindingFlags.NonPublic);
                info.SetValue(editBox, new DateTime(this.MaxValue.Year, this.MaxValue.Month, this.MaxValue.Day, this.MaxValue.Hour, this.MaxValue.Minute, this.MaxValue.Second), null);
            }
        }
    }
}

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Attached Files: