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

DatePicker (v2014.1) is blank in Chrome

1 Answer 65 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
chairman-mawh
Top achievements
Rank 1
chairman-mawh asked on 10 Mar 2020, 06:37 PM

Hi guys

 

If I use

Html.Kendo().DatePickerFor(mdl => mdl.SomeDate).Events(c => c.Change(...))

 

I get a problem in Chrome 80, in that it appears blank (it does have a value in the HTML) until I choose another date from the dropdown (and then it shows)

 

If I use 

Html.Kendo().DatePicker().Name(...).Value(Model.SomeDate).HtmlAttributes(new { type = "text" }).Events(c => c.Change(...))

 

Then it looks OK but doesn't fire the events when changed with the keyboard/dropdown

 

Any pointers? (and alas I can't upgrade either; seems the stuff in nuget doesn't target 4.6.1, only 4.5.2 or core; using too recent a one (anything after v2016.2.607) installs practically all of .net core as dependency, and anything before it wont install because of missing dependencies or target framework issues

1 Answer, 1 is accepted

Sort by
0
chairman-mawh
Top achievements
Rank 1
answered on 11 Mar 2020, 09:29 AM

I was confused by this, and remain slightly so, but it's no longer a problem as the latter form above worked out OK - there was a problem elsewhere in the scripting that meant the events were erroring

 

The confusion remains because the former way (DatePickerFor) was indeed putting "type=text" in the attributes, not "type=date". By some accident of coding I had both these code forms on the page simultaneously, with one picker being called SomeDate and the other being called xxx. The code handling the events was hard wired to look for SomeDate control, and pull its value before making an ajax call. Interestingly when the second datepicker (the latter form) was edited, the event fired and read the Value from the first datepicker, which resulted in an error "The date is not in the format yyyy-mm-dd" - it's true, the format of the date in these pickers is mm/dd/yyyy.

 

I never resolved or found out whether this error was related to the picker's inability to show the initial value it was given, but the latter form works     

Tags
Date/Time Pickers
Asked by
chairman-mawh
Top achievements
Rank 1
Answers by
chairman-mawh
Top achievements
Rank 1
Share this question
or