DatePicker (v2014.1) is blank in Chrome

2 posts, 0 answers
  1. chairman-mawh
    chairman-mawh avatar
    12 posts
    Member since:
    Jul 2017

    Posted 10 Mar Link to this post

    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

  2. chairman-mawh
    chairman-mawh avatar
    12 posts
    Member since:
    Jul 2017

    Posted 11 Mar in reply to chairman-mawh Link to this post

    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     

Back to Top