Unplanned
Last Updated: 08 Jul 2021 08:47 by ADMIN
Andy
Created on: 27 May 2020 13:01
Category: DateTimePicker
Type: Bug Report
7
The Set button should not be enabled until you select a date and a month

The Set button should not be enabled when you change the month from the button in the popup, until the user selects a date too. 

===

TELERIK EDIT:

If the user clicks Set without selecting a date, the component will assume DateTime.MinValue. You can set the current DateTime or clear the Value by using the DateTimePicker OnChange or ValueChanged event:

<TelerikDateTimePicker @bind-Value="@DateTimePickerValue"
                       OnChange="@DateTimePickerValueChanged"
                       Width="300px">
</TelerikDateTimePicker>

@code {
    private DateTime? DateTimePickerValue { get; set; }

    private void DateTimePickerValueChanged(object currentValue)
    {
        if (DateTimePickerValue.HasValue && DateTimePickerValue.Value == DateTime.MinValue)
        {
            // Set current DateTime
            DateTimePickerValue = DateTime.Now;

            // OR

            // Clear the value
            //DateTimePickerValue = default;
        }
    }
}

0 comments