Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo UI Datepicker disable typing

I want users to be able to change a Kendo UI Datepicker value only through its button and selecting the date from the pop-up. How can I prevent users from typing in the Datepicker textbox? Can I disable the textbox without disabling the whole control?

like image 283
Pejman Avatar asked Jul 02 '13 21:07

Pejman


People also ask

How do I disable kendo DatePicker?

By default, the DatePicker is enabled. To disable the component, set its disabled property to true .


2 Answers

On your input element add this attribute and value...

onkeydown="return false;" 

This will disable typed input and still allow using the calendar control input.

like image 52
Justin Russo Avatar answered Sep 24 '22 02:09

Justin Russo


Use the control as below-

@(Html.Kendo().DatePicker() .Name("FromDate") .HtmlAttributes(onkeydown="javascript:return false;" })       ) 

It will disable keyboard typing. Same way other conditions also can be handled.

like image 44
Sharad Tripathi Avatar answered Sep 22 '22 02:09

Sharad Tripathi