Home How can i make DatePickerFor a readonly?
Reply: 2

How can i make DatePickerFor a readonly?

Hamza
1#
Hamza Published in 2017-12-07 12:22:50Z

i have the DatePickerFor and i want to make it readonly I want to force user to pick dates ,not being able to type them.

<td>@(Html.Kendo().DatePickerFor(model => model.DateRecherche).Max(DateTime.Today))</td>

Thanks.

Andrei
2#
Andrei Reply to 2017-12-07 12:30:10Z

Is it in their docs:

//DISABLE inputs
$("#datepicker").attr("readonly", true);
$("#monthpicker").attr("readonly", true);

So you will need a little bit of javascript along with your view code to implement this behavior

mhatch
3#
mhatch Reply to 2017-12-07 21:51:50Z

Adding the attribute readonly to an input tag will make it read only. You can do this with jQuery like this:

$(function () {
        $('.k-datepicker input').attr('readonly', 'true');
    });
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.356786 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO