DateTimePicker TagHelper Overview
The Telerik UI DateTimePicker TagHelper for ASP.NET Core is a server-side wrapper for the Kendo UI DateTimePicker widget.
The DateTimePicker allows the user to select a value from a calendar, a time drop-down list, or through direct input.
The DateTimePicker is part of Telerik UI for ASP.NET Core, a
professional grade UI library with 100+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
Initializing the DateTimePicker
The following example demonstrates how to define the DateTimePicker by using the DateTimePicker TagHelper.
<kendo-datetimepicker name="timepicker1"></kendo-datetimepicker>
Basic Configuration
The DateTimePicker TagHelper configuration options are passed as attributes of the tag.
@(Html.Kendo().DateTimePicker()
.Name("end")
.Value(DateTime.Today)
.Min(DateTime.Today)
.Events(e => e.Change("endChange"))
)
<kendo-datetimepicker name="end" value="DateTime.Today"
min="DateTime.Today" on-change="endChange">
</kendo-datetimepicker>
The ParseFormats
option is of type string[]
and can be assigned either by a ViewBag
property or by a property of the model.
@{
ViewBag.ParseDates = new string[] { "MMMM yyyy", "MMMM" };
}
<kendo-datetimepicker name="datetimepicker" parse-formats="ViewBag.ParseDates"></kendo-datetimepicker>