Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (40 sloc) 2.05 KB
@page "/datepicker"
@using NorthwindBlazor.Data
@using NorthwindBlazor.Models.Northwind
@using Microsoft.EntityFrameworkCore
<h1 style="display:inline">DatePicker</h1><a style="margin-left: 10px" href="https://github.com/akorchev/blazor.radzen.com/blob/master/Pages/DatePickerPage.razor" target="_blank">[source code]</a>
<p>This page demonstrates <b>DatePicker</b> component.</p>
<RadzenCard>
<div class="row">
<div class="col-md-6">
<h3>DatePicker</h3>
<RadzenDatePicker Change="@(args => Change(args, "DatePicker", "MM/dd/yyyy"))" />
<h3 style="margin-top: 40px">DatePicker with time</h3>
<RadzenDatePicker ShowTime="true" Change="@(args => Change(args, "DatePicker with time", "MM/dd/yyyy HH:mm"))" DateFormat="MM/dd/yyyy HH:mm" />
<h3 style="margin-top: 40px">DatePicker with 12 hour time format</h3>
<RadzenDatePicker ShowTime="true" Change="@(args => Change(args, "DatePicker with 12 hour time format", "MM/dd/yyyy h:mm tt"))" HourFormat="12" DateFormat="MM/dd/yyyy h:mm tt" />
<h3 style="margin-top: 40px">Time-only DatePicker</h3>
<RadzenDatePicker ShowTime="true" TimeOnly="true" DateFormat="HH:mm" Change="@(args => Change(args, "Time-only DatePicker", "HH:mm"))" />
<h3 style="margin-top: 40px">Calendar</h3>
<RadzenDatePicker Inline="true" Change="@(args => Change(args, "Calendar", "MM/dd/yyyy"))" />
</div>
<div class="col-md-6">
<h3>Events</h3>
<RadzenCard style="overflow: auto;height:750px;">
@foreach (var e in events.OrderByDescending(i => i.Key))
{
@e.Value
<br />
}
</RadzenCard>
</div>
</div>
</RadzenCard>
@code {
Dictionary<DateTime, string> events = new Dictionary<DateTime, string>();
void Change(DateTime? value, string name, string format)
{
events.Add(DateTime.Now, $"{name} value changed to {value?.ToString(format)}");
StateHasChanged();
}
}
You can’t perform that action at this time.