Disable Dates

The DateTimePicker provides the opportunity to disable certain days, such as weekends, national holidays, and others, which are not intended to be selected by the end user.

To disable a date, either:

For a complete example, refer to the demo on disabling dates in the DateTimePicker.

Setting an Array

To disable dates by setting an array, list the names of days that will be disabled by using the first letters from their names in English.

    @(Html.Kendo().DateTimePicker()
        .Name("dateTimePicker")
        .Value(DateTime.Now)
        .DisableDates(new[] {"we", "th" })
    )

Adding a Function

To disable dates through using a function, set the return value for the date that will be disabled to true.

    @(Html.Kendo().DateTimePicker()
        .Name("dateTimePicker")
        .Value(DateTime.Now)
        .DisableDates("disableDatesHandler")
    )

    <script type="text/javascript">
        function disableDatesHandler(date){
            var disabled = [13,14,20,21];
            if (date && disabled.indexOf(date.getDate()) > -1 ) {
                return true;
            } else {
                return false;
            }
        }
    </script>

See Also

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