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

标签 javascript asp.net asp.net-mvc kendo-ui

我的 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 时间选择器,而是使用 Kendo 时间选择器小部件的 Enable 方法。

例如

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

希望这有帮助!

关于javascript - 如何更改Kendo TimePicker的禁用属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29196143/

相关文章:

Javascript将元素放在坐标/百分比上

javascript - 试图找到一种方法在 Shopify 中仅显示一次脚本部分。

asp.net - 我怎样才能将其转换为asp.net?

c# - 使用 iTextSharp 打开另存为窗口

asp.net-mvc - 如何防止页面刷新?

javascript - 在父DIV下按类查找DIV

javascript - Atom 文本编辑器自动完成未拾取我的 .css 文件

asp.net - 解决 IIS .NET 网站中断问题

c# - 在发布到 MVC Controller 时使用 DataAnnotations 排除特定字符串

c# - 如何在 Asp.Net MVC 4 中模拟 HttpContext.User.Identity.Name