Edit this page

DateInput HtmlHelper Overview

The DateInput HtmlHelper extension is a server-side wrapper for the Kendo UI DateInput widget.

For more information on the HtmlHelper, refer to the article on the DateInput HtmlHelper for ASP.NET MVC.

Configuration

The following example demonstrates the basic configuration for the DateInput.

Example
    @(Html.Kendo().DateInput()
        .Name("dateinput") //The name of the DateInput is mandatory. It specifies the "id" attribute of the widget.
        .Value(DateTime.Today) //Set the value of the DateInput.
    )

Event Handling

You can subscribe to all DateInput events.

The following example demonstrates how to subscribe to events by a handler name.

Example
    @(Html.Kendo().DateInput()
        .Name("dateinput")
        .Events(e => e
            .Change("dateInput_change")
        )
    )
    <script>
    function dateInput_change() {
        //Handle the change event
    }
    </script>

Reference

Existing Instances

To reference an existing Kendo UI DateInput instance, use the jQuery.data() configuration option. Once a reference is established, use the DateInput API to control its behavior.

The following example demonstrates how to access an existing DateInput instance.

Example
    //Put this after your Kendo UI DateInput for ASP.NET Core declaration.
    <script>
    $(function() {
    //Notice that the Name() of the DateInput is used to get its client-side instance.
        var dateInput = $("#dateinput").data("kendoDateInput");
    });
    </script>

See Also