New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Defines the fluent API for configuring the Kendo UI DatePicker

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class DatePickerBuilder : MvvmWidgetBuilderBase<DatePicker, DatePickerBuilder>, IHtmlContent

Inheritance: objectHelperResultWidgetBuilderBase<DatePicker, DatePickerBuilder>MvvmWidgetBuilderBase<DatePicker, DatePickerBuilder>DatePickerBuilder

Implements: IHtmlContent

Inherited Members MvvmWidgetBuilderBase<DatePicker, DatePickerBuilder>.UseMvvmInitialization(bool)MvvmWidgetBuilderBase<DatePicker, DatePickerBuilder>.UseMvvmInitialization()WidgetBuilderBase<DatePicker, DatePickerBuilder>.ToComponent()WidgetBuilderBase<DatePicker, DatePickerBuilder>.Expression(string)WidgetBuilderBase<DatePicker, DatePickerBuilder>.Explorer(ModelExplorer)WidgetBuilderBase<DatePicker, DatePickerBuilder>.Name(string)WidgetBuilderBase<DatePicker, DatePickerBuilder>.Deferred(bool)WidgetBuilderBase<DatePicker, DatePickerBuilder>.HtmlAttributes(object)WidgetBuilderBase<DatePicker, DatePickerBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<DatePicker, DatePickerBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<DatePicker, DatePickerBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<DatePicker, DatePickerBuilder>.Render()WidgetBuilderBase<DatePicker, DatePickerBuilder>.ToHtmlString()WidgetBuilderBase<DatePicker, DatePickerBuilder>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<DatePicker, DatePickerBuilder>.ToClientTemplate()WidgetBuilderBase<DatePicker, DatePickerBuilder>.AsModule(bool)WidgetBuilderBase<DatePicker, DatePickerBuilder>.ComponentWidgetBuilderBase<DatePicker, DatePickerBuilder>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the DatePickerBuilder class.

C#
public DatePickerBuilder(DatePicker component)
Parameters:componentDatePicker

Methods

Specifies the adaptive rendering of the component.

C#
public DatePickerBuilder AdaptiveMode(AdaptiveMode value)
Parameters:valueAdaptiveMode

The value for AdaptiveMode

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Allows customization of the subtitle's text in the adaptive view of the component.

C#
public DatePickerBuilder AdaptiveSubtitle(string value)
Parameters:valuestring

The value for AdaptiveSubtitle

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Allows customization of the title's text in the adaptive view of the component.

C#
public DatePickerBuilder AdaptiveTitle(string value)
Parameters:valuestring

The value for AdaptiveTitle

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Configures the animation effects of the widget.

C#
public DatePickerBuilder Animation(Action<PopupAnimationBuilder> animationAction)
Parameters:animationActionAction<PopupAnimationBuilder>

The action which configures the animation effects.

Returns:

DatePickerBuilder

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Animation(animation =&gt;
{
animation.Open(open =&gt;
{
open.SlideIn(SlideDirection.Down);
})
})
)

Use to enable or disable animation of the popup element.

C#
public DatePickerBuilder Animation(bool enable)
Parameters:enablebool

The boolean value.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Animation(false) //toggle effect
)

Specifies a template used to populate the value of the aria-label attribute of the currently focused cell of the calendar. The parameters available for the template are: current - The current focused date.; valueType - The focused item value type - month, year and etc. or text - A text representing the focused value..

C#
public DatePickerBuilder ARIATemplate(string value)
Parameters:valuestring

The value for ARIATemplate

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.ARIATemplate("Date: #=kendo.toString(data.current, 'd')#")
)

Specifies a template used to populate the value of the aria-label attribute of the currently focused cell of the calendar. The parameters available for the template are: current - The current focused date.; valueType - The focused item value type - month, year and etc. or text - A text representing the focused value..

C#
public DatePickerBuilder ARIATemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the ariatemplate.

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies a template used to populate the value of the aria-label attribute of the currently focused cell of the calendar. The parameters available for the template are: current - The current focused date.; valueType - The focused item value type - month, year and etc. or text - A text representing the focused value..

C#
public DatePickerBuilder ARIATemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for ARIATemplate

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies a template used to populate the value of the aria-label attribute of the currently focused cell of the calendar. The parameters available for the template are: current - The current focused date.; valueType - The focused item value type - month, year and etc. or text - A text representing the focused value..

C#
public DatePickerBuilder ARIATemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for ARIATemplate

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies a template used to populate the value of the aria-label attribute of the currently focused cell of the calendar. The parameters available for the template are: current - The current focused date.; valueType - The focused item value type - month, year and etc. or text - A text representing the focused value..

C#
public DatePickerBuilder ARIATemplateView(IHtmlContent templateView)
Parameters:templateViewIHtmlContent

The view that contains the template for ARIATemplate

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

If this property is enabled and you have configured min and/or max values, and the user enters a value that falls out of that range, the value will automatically be set to either the minimum or maximum allowed value. This property has effect only when the dateInput of the component is enabled.

C#
public DatePickerBuilder AutoAdjust(bool value)
Parameters:valuebool

The value for AutoAdjust

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Sets a value that indicates whether to automatically correct the segment when out of range. In order to work, dateInput prop should be set to true.

C#
public DatePickerBuilder AutoCorrectParts(bool value)
Parameters:valuebool

The value for AutoCorrectParts

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

When enabled, the DatePicker will autofill the rest of the date to the current date when the component loses focus. For example, entering only the date, month or year portion of the date and blurring the component, the missing sections will be automatically completed. Requires a DateInput for editing the value.

C#
public DatePickerBuilder AutoFill()
Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

When enabled, the DatePicker will autofill the rest of the date to the current date when the component loses focus. For example, entering only the date, month or year portion of the date and blurring the component, the missing sections will be automatically completed. Requires a DateInput for editing the value.

C#
public DatePickerBuilder AutoFill(bool value)
Parameters:valuebool

The value for AutoFill

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies a list of dates, which will be passed to the month template.

C#
public DatePickerBuilder BindTo(List<DateTime> dates)
Parameters:datesList<DateTime>

The dates.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.BindTo(new List&lt;DateTime&gt; { DateTime.Now })
)

Specifies the component type of the widget. "classic" - Uses the standard rendering of the widget. or "modern" - Uses new rendering with a fresh and modern look and feel..

C#
public DatePickerBuilder ComponentType(string value)
Parameters:valuestring

The value for ComponentType

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.ComponentType("modern")
)

Specifies the culture info used by the widget.

C#
public DatePickerBuilder Culture(string value)
Parameters:valuestring

The value for Culture

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies if the DatePicker will use DateInput for editing value

C#
public DatePickerBuilder DateInput()
Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies if the DatePicker will use DateInput for editing value

C#
public DatePickerBuilder DateInput(bool value)
Parameters:valuebool

The value for DateInput

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies a list of dates, which will be passed to the month content.

C#
public DatePickerBuilder Dates(params DateTime[] value)
Parameters:valueDateTime[]

The value for Dates

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies the navigation depth.

C#
public DatePickerBuilder Depth(CalendarView value)
Parameters:valueCalendarView

The value for Depth

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Depth(CalendarView.Month)
)

Specifies the disabled dates in the DatePicker widget.

C#
public DatePickerBuilder DisableDates(params DayOfWeek[] days)
Parameters:daysDayOfWeek[]

Configures the disabled dates.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("datePicker")
.DisableDates(DayofWeek.Saturday, DayOfWeek.Sunday)
)

Specifies the disabled dates in the DatePicker widget using a function handler.

C#
public DatePickerBuilder DisableDates(string handler)
Parameters:handlerstring

Configures the disabled dates.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("datePicker")
.DisableDates("disableDates")
)

Enables or disables the picker.

C#
public DatePickerBuilder Enable(bool value)
Parameters:valueboolReturns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("datePicker")
.Enable(false)
)

Configures the client-side events.

C#
public DatePickerBuilder Events(Action<DatePickerEventBuilder> configurator)
Parameters:configuratorAction<DatePickerEventBuilder>

The client events action.

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Events(events =&gt; events
.Change("onChange")
)
)

Sets a value controlling how the color is applied.

C#
public DatePickerBuilder FillMode(FillMode value)
Parameters:valueFillMode

The value for FillMode

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.FillMode(FillMode.Outline)
)

Enables/disables footer of the calendar popup.

C#
public DatePickerBuilder Footer(bool footer)
Parameters:footerbool

If set to false, disables the footer.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Footer(false)
)

The template which renders the footer of the calendar. If false, the footer will not be rendered.

C#
public DatePickerBuilder Footer(string value)
Parameters:valuestring

The value for Footer

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Footer(false)
)

FooterId to be used for rendering the footer of the Calendar.

C#
public DatePickerBuilder FooterId(string id)
Parameters:idstring

The footer template's id.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.FooterId("widgetFooterId")
)

Specifies the format, which is used to format the value of the DatePicker displayed in the input. The format also will be used to parse the input.For more information on date and time formats please refer to Date Formatting.

C#
public DatePickerBuilder Format(string value)
Parameters:valuestring

The value for Format

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Specifies the inputmode attribute of the inner <input /> element. It is used to specify the type of on-screen keyboard that should be displayed when the user focuses the input.

C#
public DatePickerBuilder InputMode(string value)
Parameters:valuestring

The value for InputMode

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("datePicker")
.InputMode("numeric")
)

Adds a label before the datepicker. If the datepicker has no id attribute, a generated id will be assigned. The string and the function parameters are setting the inner HTML of the label.

C#
public DatePickerBuilder Label(Action<DatePickerLabelSettingsBuilder> configurator)
Parameters:configuratorAction<DatePickerLabelSettingsBuilder>

The DatePickerLabelSettingsBuilder for the label setting.

Returns:

DatePickerBuilder

Returns the current instance of DatePickerBuilder .

Adds a label before the datepicker. If the datepicker has no id attribute, a generated id will be assigned. The string and the function parameters are setting the inner HTML of the label.

C#
public DatePickerBuilder Label(string label)
Parameters:labelstring

The label.

Returns:

DatePickerBuilder

Returns the current instance of DatePickerBuilder .

Specifies the maximum date, which the calendar can show.

C#
public DatePickerBuilder Max(DateTime value)
Parameters:valueDateTime

The value for Max

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Max("01/02/2022")
)

Sets the maximal date, which can be selected in DatePicker.

C#
public DatePickerBuilder Max(string date)
Parameters:datestring

The maximal date of the picker.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Max("01/02/2022")
)

Allows localization of the strings that are used in the widget.

C#
public DatePickerBuilder Messages(Action<DatePickerMessagesSettingsBuilder> configurator)
Parameters:configuratorAction<DatePickerMessagesSettingsBuilder>

The DatePickerMessagesSettingsBuilder for the messages setting.

Returns:

DatePickerBuilder

Returns the current instance of DatePickerBuilder .

Specifies the minimum date that the calendar can show.

C#
public DatePickerBuilder Min(DateTime value)
Parameters:valueDateTime

The value for Min

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Min("01/02/2010")
)

Sets the minimal date, which can be selected in DatePicker.

C#
public DatePickerBuilder Min(string date)
Parameters:datestring

The minimal date of the picker.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Min("01/02/2010")
)

Configures the content of cells of the Calendar.

C#
public DatePickerBuilder MonthTemplate(Action<MonthTemplateBuilder> monthTemplateAction)
Parameters:monthTemplateActionAction<MonthTemplateBuilder>Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.MonthTemplate(month =&gt; month.Content("#= data.value #"))
)

Templates for the cells rendered in the "month" view.

C#
public DatePickerBuilder MonthTemplate(string content)
Parameters:contentstring

The month template's content.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.MonthTemplate("#= data.value #")
)

Templates for the cells rendered in the "month" view.

C#
public DatePickerBuilder MonthTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

The template that will be used for the content of the cell values.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.MonthTemplate(Html.Kendo().Template()
.AddHtml("&lt;div&gt;${data.value} &lt;/div&gt;")
)
)

MonthTemplateHandler method.

C#
public DatePickerBuilder MonthTemplateHandler(string templateHandler)
Parameters:templateHandlerstringReturns:

DatePickerBuilder

MonthTemplateId to be used for rendering the cells of the Calendar.

C#
public DatePickerBuilder MonthTemplateId(string id)
Parameters:idstring

The month template's id.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.MonthTemplateId("widgetMonthTemplateId")
)

MonthTemplateId to be used for rendering the cells of the Calendar.

C#
public DatePickerBuilder MonthTemplateView(IHtmlContent templateView)
Parameters:templateViewIHtmlContentReturns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@( Html.Kendo().DatePicker()
.Name("DatePicker")
.MonthTemplateView(Html.Partial("WidgetMonthTemplate"))
)

Specifies a list of date formats used to parse the value set with value() method or by direct user input. If not set the value of the format will be used. Note that the format option is always used during parsing.

C#
public DatePickerBuilder ParseFormats(params string[] value)
Parameters:valuestring[]

The value for ParseFormats

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

The options that will be used for the popup initialization. For more details about the available options refer to Popup documentation.

C#
public DatePickerBuilder Popup(Action<DatePickerPopupSettingsBuilder> configurator)
Parameters:configuratorAction<DatePickerPopupSettingsBuilder>

The DatePickerPopupSettingsBuilder for the popup setting.

Returns:

DatePickerBuilder

Returns the current instance of DatePickerBuilder .

If set to true, the widget will be readonly and will not allow user input. The widget is not readonly be default and allow user input.

C#
public DatePickerBuilder Readonly()
Returns:

DatePickerBuilder

Example:
C#
@(Html.Kendo().DatePicker()
.Name("datePicker")
.Readonly()
)

If set to true, the widget will be readonly and will not allow user input. The widget is not readonly be default and allow user input.

C#
public DatePickerBuilder Readonly(bool value)
Parameters:valuebool

The value for Readonly

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Sets a value controlling the border radius.

C#
public DatePickerBuilder Rounded(Rounded value)
Parameters:valueRounded

The value for Rounded

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Rounded(Rounded.Medium)
)

Sets the size of the component.

C#
public DatePickerBuilder Size(ComponentSize value)
Parameters:valueComponentSize

The value for Size

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Size(ComponentSize.Medium)
)

Specifies the start view. The following settings are available for the start value: "month" - Shows the days of the month.; "year" - Shows the months of the year.; "decade" - Shows the years of the decade. or "century" - Shows the decades from the century..

C#
public DatePickerBuilder Start(CalendarView value)
Parameters:valueCalendarView

The value for Start

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.Start(CalendarView.Month)
)

Specifies the selected date.

C#
public DatePickerBuilder Value(DateOnly? value)
Parameters:valueDateOnly?

The value for Value

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Specifies the selected date.

C#
public DatePickerBuilder Value(DateOnly value)
Parameters:valueDateOnly

The value for Value

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Sets the value of the picker input

C#
public DatePickerBuilder Value(DateTime? date)
Parameters:dateDateTime?

The initial value of the picker.

Returns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("datePicker")
.Value(DateTime.Now)
)

Specifies the selected date.

C#
public DatePickerBuilder Value(DateTime value)
Parameters:valueDateTime

The value for Value

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Sets the value of the picker input

C#
public DatePickerBuilder Value(string date)
Parameters:datestringReturns:

DatePickerBuilder

A DatePickerBuilder instance for method chaining.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("datePicker")
.Value("8/1/2022")
)

If set to true a week of the year will be shown on the left side of the calendar. It is possible to define a template in order to customize what will be displayed.

C#
public DatePickerBuilder WeekNumber()
Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

If set to true a week of the year will be shown on the left side of the calendar. It is possible to define a template in order to customize what will be displayed.

C#
public DatePickerBuilder WeekNumber(bool value)
Parameters:valuebool

The value for WeekNumber

Returns:

DatePickerBuilder

Returns the current DatePickerBuilder instance.

Example:
C#
@(Html.Kendo().DatePicker()
.Name("DatePicker")
.WeekNumber(true)
)