DatePicker Close() not working #1151

Open
opened 2026-01-29 17:49:38 +00:00 by claunia · 0 comments
Owner

Originally created by @nielsNocore on GitHub (Mar 4, 2024).

Describe the bug
Calling the Close method on a DatePicker does not close the popup.

To Reproduce
Go go the demo page with custom fotter: https://blazor.radzen.com/datepicker#custom-footer
change code to this:

<div class="rz-p-12 rz-text-align-center">
    <RadzenLabel Text="Select Date" Component="DatePickerFooterTemplate" Style="margin-right: 8px; vertical-align: middle;" />
    <RadzenDatePicker @ref="_datePickerRef" @bind-Value=@value Name="DatePickerFooterTemplate">
        <FooterTemplate>
            <RadzenButton Click=@OnTodayClick Text="Today" class="my-3 w-100" />
        </FooterTemplate>
    </RadzenDatePicker>
</div>

code {
    private RadzenDatePicker<DateTime?> _datePickerRef;
    DateTime? value = DateTime.Now;

    private void OnTodayClick()
    {
        value = DateTime.Today;
        _datePickerRef!.Close();
    }
}

Click Today button

Expected behavior
The date of today is selected and the Popup is closed.
But the popup is not closed.

Originally created by @nielsNocore on GitHub (Mar 4, 2024). **Describe the bug** Calling the Close method on a DatePicker does not close the popup. **To Reproduce** Go go the demo page with custom fotter: https://blazor.radzen.com/datepicker#custom-footer change code to this: ``` <div class="rz-p-12 rz-text-align-center"> <RadzenLabel Text="Select Date" Component="DatePickerFooterTemplate" Style="margin-right: 8px; vertical-align: middle;" /> <RadzenDatePicker @ref="_datePickerRef" @bind-Value=@value Name="DatePickerFooterTemplate"> <FooterTemplate> <RadzenButton Click=@OnTodayClick Text="Today" class="my-3 w-100" /> </FooterTemplate> </RadzenDatePicker> </div> code { private RadzenDatePicker<DateTime?> _datePickerRef; DateTime? value = DateTime.Now; private void OnTodayClick() { value = DateTime.Today; _datePickerRef!.Close(); } } ``` Click Today button **Expected behavior** The date of today is selected and the Popup is **closed**. But the popup is not closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1151