DatePicker TagHelper Overview
The Telerik UI DatePicker TagHelper for ASP.NET Core is a server-side wrapper for the Kendo UI DatePicker widget.
The DatePicker enables the user to enter or pick a date value.
The DatePicker 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 DatePicker
The following example demonstrates how to define the DatePicker by using the DatePicker TagHelper.
<kendo-datepicker name="datepicker1"></kendo-datepicker>
Basic Configuration
The DatePicker TagHelper configuration options are passed as attributes of the tag.
@(Html.Kendo().DatePicker()
.Name("monthpicker")
.Start(CalendarView.Year)
.Depth(CalendarView.Year)
.Format("MMMM yyyy")
.Value(DateTime.Now)
)
<kendo-datepicker name="monthpicker" start="CalendarView.Year" depth="CalendarView.Year"
format="MMMM yyyy" value="DateTime.Now">
</kendo-datepicker>
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-datepicker name="datepicker" parse-formats="ViewBag.ParseDates"></kendo-datepicker>