DateInput HtmlHelper Overview

The Telerik UI DateInput HtmlHelper for ASP.NET Core is a server-side wrapper for the Kendo UI DateInput widget.

The DateInput represents an input field that recognizes and formats scheduling values such as dates. It provides separate sections for days, months, years, hours, and minutes, and also supports the customization of date and time formats.

Basic Configuration

The following example demonstrates the basic configuration for the DateInput.

    @(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.
    )

Events

You can subscribe to all DateInput events. For a complete example on basic DateInput events, refer to the demo on using the events of the DateInput.

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

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

Referencing Existing Instances

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

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

See Also

In this article
Not finding the help you need? Improve this article