如何更改 Kendo TimePicker 的禁用属性?

How to change disabled attribute of Kendo TimePicker?

我的 mvc 应用程序需要一些帮助。

我正在使用以下代码创建一个 Kendo TimePicker。

@(Html.Kendo().TimePicker().Name("FirstShiftFrom" + prop.PropertyName.Substring(0, 3))
                           .HtmlAttributes(new { @class = "workHoursTimePicker " + prop.PropertyName ,@disabled = "disabled" ,style="width:85px"})

如何启用此控件?

我在 js 中尝试过这个:

document.get.Element.By.Id("id").disabled = false;

但它不起作用!

而不是使用 HTML disabled 属性来禁用 Kendo 时间选择器使用 Enable 方法 Kendo 时间选择器小部件。

例如

@(Html.Kendo().TimePicker().Name("FirstShiftFrom" + prop.PropertyName.Substring(0, 3))
                       .HtmlAttributes(new { @class = "workHoursTimePicker " + prop.PropertyName, style = "width:85px" })
                       .Enable(false))

这将禁用时间选择器并启用它在 javascript:

$("#TimePickerId").data("kendoTimePicker").enable(true);

希望对您有所帮助!