This is a migrated thread and some comments may be shown as answers.

Kendo DatePicker value(), class Issue

1 Answer 190 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Mauro asked on 21 Aug 2013, 09:25 AM
Hi to everyone.
I have an MVC view with a Kendo DatePicker
                        .HtmlAttributes(new  {style = "width: 150px;" })

I need to change the date of my element from javascript, and I'm doing it in this way
                value: new Date(),        
                format: "dd/MM/yyyy", ( I have to do this because it doesn't remember the given format in the helper )

It works but this function changes some style in the element, in particular in the first span
k-input is added causing a padding issue and style has now a width:100%, not 150px as I set in the helper and I have when the page is just opened
so before
<span class="k-widget k-datepicker k-header" style="width: 150px;">
<span class="k-widget k-datepicker k-header k-input" style="width: 100%;">

I have to use an ugly workaround changing the class and style from jquery but I was wondering if there is a better solution

any help is appreciated

1 Answer, 1 is accepted

Sort by
Georgi Krustev
Telerik team
answered on 22 Aug 2013, 07:48 AM
Hello Mauro,

In general, the Kendo widgets are designed to be initialized only once. Any subsequent initializations will modify the html and styling. 
In order to change the value of the widget after its initialization, you will need to get the instance of the client object and use the value method.

Georgi Krustev
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Date/Time Pickers
Asked by
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question