saleem
saleem

Reputation: 415

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!

Upvotes: 0

Views: 2837

Answers (1)

Satya Ranjan Sahoo
Satya Ranjan Sahoo

Reputation: 1086

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

e.g.

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

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

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

Hope this helps!

Upvotes: 3

Related Questions