New to Telerik UI for ASP.NET MVC? Download free 30-day trial

DatePickerBuilder

Defines the fluent interface for configuring the DatePicker component.

Methods

ARIATemplate(System.String)

Specifies a template used to populate aria-label attribute.

Parameters

template - System.String

The string template.

Example


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

BindTo(System.Collections.Generic.List)

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

Parameters

dates - System.Collections.Generic.List<DateTime>

The dates.

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .BindTo(new List<DateTime> { DateTime.Now })
             )

FooterId(System.String)

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

Parameters

id - System.String

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .FooterId("widgetFooterId")
             )

Footer(System.String)

Footer template to be used for rendering the footer of the Calendar.

Parameters

footer - System.String

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Footer("#= kendo.toString(data, "G") #")
             )

Footer(System.Boolean)

Enables/disables footer of the calendar popup.

Parameters

footer - System.Boolean

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Footer(false)
             )

Depth(Kendo.Mvc.UI.CalendarView)

Specifies the navigation depth.

Parameters

depth - CalendarView

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Depth(CalendarView.Month)
            )

Start(Kendo.Mvc.UI.CalendarView)

Specifies the start view.

Parameters

start - CalendarView

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Start(CalendarView.Month)
             )

WeekNumber(System.Boolean)

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.

Parameters

weekNumber - System.Boolean

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .WeekNumber(true)
             )

MonthTemplateId(System.String)

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

Parameters

id - System.String

Example


               @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .MonthTemplateId("widgetMonthTemplateId")
               )

MonthTemplateView(System.Web.Mvc.MvcHtmlString)

Parameters

template - System.Web.Mvc.MvcHtmlString

MonthTemplateHandler(System.String)

Parameters

value - System.String

MonthTemplate(System.String)

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

Parameters

content - System.String

Example


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

MonthTemplate(System.Action)

Configures the content of cells of the Calendar.

Parameters

monthTemplateAction - System.Action<MonthTemplateBuilder>

Example


                @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .MonthTemplate(month => month.Content("#= data.value #"))
                )

Min(System.String)

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

Parameters

date - System.String

The minimal date of the picker.

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Min("01/02/2010")
             )

Max(System.String)

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

Parameters

date - System.String

The maximal date of the picker.

Example


             @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Max("01/02/2022")
             )

DisableDates(System.Collections.Generic.IEnumerable)

Parameters

disableDates - System.Collections.Generic.IEnumerable<String>

DisableDates(System.DayOfWeek[])

Specifies the disabled dates in the DatePicker widget.

Parameters

days - System.DayOfWeek[]

Example


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

DisableDates(System.String)

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

Parameters

handler - System.String

Example


                @(Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .DisableDates("disableDates")
                )

ComponentType(System.String)

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..

Parameters

value - System.String

The value for ComponentType

Example


                 @(Html.Kendo().DatePicker()
                          .Name("DatePicker")
                          .ComponentType("modern")
                 )

Size(Kendo.Mvc.UI.ComponentSize)

Sets the size of the component.

Parameters

value - ComponentSize

The value for Size

Example


                 @(Html.Kendo().DatePicker()
                          .Name("DatePicker")
                          .Size(ComponentSize.Medium)
                 )

Rounded(Kendo.Mvc.UI.Rounded)

Sets a value controlling the border radius.

Parameters

value - Rounded

The value for Rounded

Example


                 @(Html.Kendo().DatePicker()
                          .Name("DatePicker")
                          .Rounded(Rounded.Medium)
                 )

FillMode(Kendo.Mvc.UI.FillMode)

Sets a value controlling how the color is applied.

Parameters

value - FillMode

The value for FillMode

Example


                 @(Html.Kendo().DatePicker()
                          .Name("DatePicker")
                          .FillMode(FillMode.Outline)
                 )

Animation(System.Boolean)

Use to enable or disable animation of the popup element.

Parameters

enable - System.Boolean

The boolean value.

Example


            @( Html.Kendo().DatePicker()
                       .Name("DatePicker")
                       .Animation(false) //toggle effect
            )

Animation(System.Action)

Configures the animation effects of the widget.

Parameters

animationAction - System.Action<PopupAnimationBuilder>

The action which configures the animation effects.

Example


            @( Html.Kendo().DatePicker()
                       .Name("DatePicker")
                       .Animation(animation =>
                       {
                            animation.Open(open =>
                            {
                                open.SlideIn(SlideDirection.Down);
                            })
                       })
            )

Culture(System.String)

Specifies the culture info used by the widget.

Parameters

culture - System.String

Example


             @( Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Culture("de-DE")
            )

Events(System.Action)

Configures the client-side events.

Parameters

clientEventsAction - System.Action<DatePickerEventBuilderBase>

The client events action.

Example


             @( Html.Kendo().DatePicker()
                        .Name("DatePicker")
                        .Events(events =>
                            events.Open("open").Change("change")
                        )
            )

Format(System.String)

Sets the date format, which will be used to parse and format the machine date. Defaults to CultureInfo.DateTimeFormat.ShortDatePattern.

Parameters

format - System.String

ParseFormats(System.Collections.Generic.IEnumerable)

Specifies the formats, which are used to parse the value set with value() method or by direct input.

Parameters

formats - System.Collections.Generic.IEnumerable<String>

Enable(System.Boolean)

Enables or disables the picker.

Parameters

value - System.Boolean

Min(System.DateTime)

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

Parameters

date - System.DateTime

Max(System.DateTime)

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

Parameters

date - System.DateTime

Value(System.Nullable)

Sets the value of the picker input

Parameters

date - System.Nullable<DateTime>

Value(System.String)

Sets the value of the picker input

Parameters

date - System.String

DateInput(System.Boolean)

Specifies if the picker will use DateInput for editing value

Parameters

value - System.Boolean

The value for DateInput

DateInput()

Specifies if the picker will use DateInput for editing value

Popup(System.Action)

Configures the popup settings of the widget.

Parameters

popupAction - System.Action<PopupSettingsBuilder>

Messages(System.Action)

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

Parameters

configurator - System.Action<DatePickerBaseMessagesSettingsBuilder>

The configurator for the messages setting.

Label(System.Action)

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

Parameters

configurator - System.Action<LabelSettingsBuilder>

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);  
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean)

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsChildComponent()

Render()

Renders the component.

Example


            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?