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

Setting the DateInput Messages of the DateTimePicker

Environment

Product Telerik UI for ASP.NET Core DateTimePicker
Progress Telerik UI for ASP.NET Core version Created with the 2022.2.802 version

Description

How can I configure the messages of the date input in the Telerik UI for ASP.NET Core DateTimePicker?

Solution

To achieve the desired scenario, reference the dateInput of the DateTimePicker and use the setOptions method of the DateTimePicker to change its messages.


    @(Html.Kendo().DatePicker()
            .Name("datepicker")
            .DateInput()
            .HtmlAttributes(new { style = "width: 100%", title = "datepicker" })
    )


    <script>
        $(document).ready(function () {
            var datetimepicker = $("#OrderDate").data("kendoDatePicker");
            datetimepicker._dateInput.setOptions({
                messages: {
                    "year": "YYYY",
                    "month": "MM",
                    "day": "DD"
                }
            });
        })
    </script>

For the complete implementation of the suggested approach, refer to the Telerik REPL example on setting the date input messages of the DateTimePicker.

More ASP.NET Core DateTimePicker Resources

See Also

In this article