saleem saleem - 1 year ago 79
Javascript Question

How to change disabled attribute of Kendo TimePicker?

I need some help with my mvc application.

I am using the following code to create a Kendo TimePicker.

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

How can I enable this control?

I have tried this in js :

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

but it is not working!

Answer Source

Instead of using HTML disabled attribute to disable the Kendo Time picker use Enable method of Kendo Time picker widget.


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

This will disable the Time picker and to enable it use this in javascript:


Hope this helps!