Skip to content

Commit cc3d5f6

Browse files
kb(datePicker): select months only
1 parent c00e054 commit cc3d5f6

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Picking Only Months
3+
description: How to select only months, not dates in the date picker
4+
type: how-to
5+
page_title: Pick Only Months
6+
slug: datepicker-kb-select-months-only
7+
position:
8+
tags:
9+
ticketid: 1513216
10+
res_type: kb
11+
---
12+
13+
## Environment
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product</td>
18+
<td>DatePicker for Blazor</td>
19+
</tr>
20+
</tbody>
21+
</table>
22+
23+
24+
## Description
25+
An app needs to process data for the month - is there a way to use DatePicker and choose only the Month/Year? Displaying it is quite easy with Format.
26+
27+
Is it possible to get a DatePicker that shows a popup with only month/year selection?
28+
29+
## Solution
30+
You can use the `BottomView` to limit how far down the user can go to. If they can go down only to the Year view they will effectively select months.
31+
32+
You can also set a `Format` that shows the month and year only too.
33+
34+
Here is an example of both:
35+
36+
37+
````CSHTML
38+
@selectedDate
39+
<br />
40+
<TelerikDatePicker @bind-Value="@selectedDate"
41+
BottomView="@CalendarView.Year"
42+
Format="MMM yy">
43+
</TelerikDatePicker>
44+
45+
@code{
46+
DateTime selectedDate { get; set; } = DateTime.Now;
47+
}
48+
````

0 commit comments

Comments
 (0)