Completed
Last Updated: 09 Sep 2022 05:13 by ADMIN
Release 3.6.0 (14 Sep 2022) (R3 2022)
Fred
Created on: 18 Mar 2021 12:14
Category: DateTimePicker
Type: Feature Request
10
Add OnOpen event for DropDownList, ComboBox, AutoComplete, Multiselect, Date and Time Pickers

Add "OnOpen" event that fires when the DateTimePicker  button is clicked but before the DateTimePicker  dropdown is shown

 

=============

ADMIN EDIT

=============

You can currently achieve the desired behavior by wrapping the DateTimePicker in a container (for example span), add a handler on the on-click event of the span to catch the click event and perform the desired actions in that handler.

<span class="datetimepicker-span" @onclick="@OnOpenHandler">
    <TelerikDateTimePicker Class="my-date-time-picker" Value="@selectedTime"
                           Format="dd MMM yyyy HH:mm:ss" Width="250px"></TelerikDateTimePicker>
</span>

@code {
    public DateTime? selectedTime { get; set; }

    public bool isOpened { get; set; } = false;

    public void  OnOpenHandler()
    {
        isOpened = !isOpened;

        if (isOpened)
        {
            Console.WriteLine("DateTimePicker was opened.");
        }
        else
        {
            Console.WriteLine("DateTimePicker was closed.");
        }
    }
}

2 comments
Miroslav
Posted on: 01 Jul 2022 06:38

Hello,

in our particular case, the main type of using is to fill the list of appropriated values into the element itself (ComboBox mostly). We have a form witth many ComboBoxes, lists of their values are based on the other values and are retrieved by calling to a server. We want to ask server for the values when a user wants to show them (by opening the ComboBox) and after there is a server's response, we need to fill the ComboBox's list area and open it.

Thanks,

Miroslav

ADMIN
Tsvetomir
Posted on: 01 Jul 2022 06:22

Hello,

In order for us to provide the most useful event and event arguments, we seek scenarios where the OnOpen event will be used. Can you share what most commonly the event will be used for - for example, notifying the user of an action, disabling items, applying a value to other components/HTML?

Are there cases when the event should be prevented and the popup should remain closed? For example, based on a condition, the popup should not be opened at all.

Thank you for your feedback and input!

Kind regards,
Tsvetomir
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.