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

TimePicker: How can I get the new time value in ValueChanging Event?

1 Answer 91 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Jürgen
Top achievements
Rank 1
Jürgen asked on 10 Apr 2018, 02:13 PM

Hi all,

Unfortunatelly (bug or feature?) the ValueChanging Event routine of the RadTimePicker just pass CancelEventArgs but not ValueChangingEventArgs like in RadDateTimePicker. How can I get the new value (value that is entered by the time picker dialog) in the value changing event? I need it for validation.

Thanks!

 

Jürgen

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 11 Apr 2018, 01:41 PM
Hi Jürgen,

Thank you for writing.

The event is raised by the mask date time provider which is used by the editor of the RadTimePicker control. This provider is working with CancelEventArgs and that is why such a type is passed as an argument. In the described scenario, the event argument which is created is actually ValueChangingEventArgs and you can cast it in the event handler in your form: 
private void RadTimePicker1_ValueChanging(object sender, CancelEventArgs e)
{
    ValueChangingEventArgs args = e as ValueChangingEventArgs;
    if (args != null)
    {
        Console.WriteLine(args.NewValue);
    }
}

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

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 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
Jürgen
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or