[bug] Month-Year Datepicker missing OK button #1217

Closed
opened 2026-01-29 17:50:34 +00:00 by claunia · 1 comment
Owner

Originally created by @sendf on GitHub (Apr 27, 2024).

I'm trying to show a datepicker for Month & Year only, and I have configured the element as shown below:
image

However, on the frontend there is no OK/confirm button to submit the selection, and therefore the datepicker does not actually return any value selected:
image

Component only works when 'Show Days' is enabled.

Originally created by @sendf on GitHub (Apr 27, 2024). I'm trying to show a datepicker for Month & Year only, and I have configured the element as shown below: ![image](https://github.com/radzenhq/radzen-blazor-studio/assets/168279078/11734d82-5f38-48c9-b3ab-39e85f66c4a0) However, on the frontend there is no OK/confirm button to submit the selection, and therefore the datepicker does not actually return any value selected: ![image](https://github.com/radzenhq/radzen-blazor-studio/assets/168279078/2a72594f-2535-43ad-a22d-2eb49af58bb6) Component only works when 'Show Days' is enabled.
Author
Owner

@enchev commented on GitHub (May 23, 2024):

There is no OK button for such view - ShowButton property is used to show/hide the button for the input that will show the popup. You can define your own FooterTemplate if you need such button:

<div class="rz-p-12 rz-text-align-center">
    <RadzenLabel Text="Select Year/Month" Component="DatePickerYearMonth" Style="margin-right: 8px; vertical-align: middle;" />
    <RadzenDatePicker @ref=dp @bind-Value=@value ShowDays=false DateFormat="yyyy/MM" CurrentDateChanged=@OnCurrentDateChanged Name="DatePickerYearMonth">
        <FooterTemplate>
            <RadzenButton Click=@(args => { value = (DateTime)dp.Value; dp.Close(); } ) Text="Ok" class="my-3 w-100" />
        </FooterTemplate>
    </RadzenDatePicker>
</div>

@code {
    RadzenDatePicker<DateTime> dp;
    DateTime value = DateTime.Now;

    void OnCurrentDateChanged(DateTime args)
    {
        value = new DateTime(args.Year, args.Month, 1);
    }
}

image

@enchev commented on GitHub (May 23, 2024): There is no OK button for such view - ShowButton property is used to show/hide the button for the input that will show the popup. You can define your own FooterTemplate if you need such button: ``` <div class="rz-p-12 rz-text-align-center"> <RadzenLabel Text="Select Year/Month" Component="DatePickerYearMonth" Style="margin-right: 8px; vertical-align: middle;" /> <RadzenDatePicker @ref=dp @bind-Value=@value ShowDays=false DateFormat="yyyy/MM" CurrentDateChanged=@OnCurrentDateChanged Name="DatePickerYearMonth"> <FooterTemplate> <RadzenButton Click=@(args => { value = (DateTime)dp.Value; dp.Close(); } ) Text="Ok" class="my-3 w-100" /> </FooterTemplate> </RadzenDatePicker> </div> @code { RadzenDatePicker<DateTime> dp; DateTime value = DateTime.Now; void OnCurrentDateChanged(DateTime args) { value = new DateTime(args.Year, args.Month, 1); } } ``` ![image](https://github.com/radzenhq/radzen-blazor/assets/5804953/f6bfba5a-9c41-4dbc-a145-42c39b1e9f47)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1217