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

2 posts, 0 answers
  1. Jürgen
    Jürgen avatar
    6 posts
    Member since:
    May 2014

    Posted 10 Apr 2018 Link to this post

    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

  2. Hristo
    Admin
    Hristo avatar
    1520 posts

    Posted 11 Apr 2018 Link to this post

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