Datepicker shows no initial value

8 posts, 0 answers
  1. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 04 Oct 2015 Link to this post

    My dates pickers are showing no values when loaded, if I look at source I can see that they have a value, but it is not showing. you can see below that value is present.

    HTML generated 

    <span class="k-widget k-datepicker k-header"><span class="k-picker-wrap k-state-default"><input name="StartDate" class="k-input" id="StartDate" role="combobox" aria-disabled="false" aria-expanded="false" aria-readonly="false" aria-owns="StartDate_dateview" style="width: 100%;" type="text" value="2015/09/05" data-role="datepicker" data-val-required="The StartDate field is required." data-val="true" data-val-date="The field StartDate must be a date."><span class="k-select" role="button" aria-controls="StartDate_dateview" unselectable="on"><span class="k-icon k-i-calendar" unselectable="on">select</span></span></span></span>

     

     MVC config

    @Html.Kendo().DatePickerFor(Function(m) m).Format("yyyy/MM/dd").ParseFormats({"dd-MM-yyyy", "dd/MM/yyyy", "MM/dd/yyyy", "yyyy/MM/dd", "yyyy-MM-dd"}).Value(Model)

    Thanks

  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 07 Oct 2015 Link to this post

    Hello Alan,

    The described behavior may be observed in the Edge browser with specific cultures (formats). We have already fixed this, please upgrade Kendo UI to Q2 2015 SP2 or Q3 2015.

    http://www.telerik.com/support/whats-new/aspnet-mvc/release-history/ui-for-asp-net-mvc-q2-2015-sp2

    Regards,
    Dimo
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Gary Davis
    Gary Davis avatar
    71 posts
    Member since:
    Oct 2003

    Posted 08 Jan in reply to Dimo Link to this post

    I have this problem in Edge using the current Kendo 2015.3.1111.
    Generated (note type="date" which is different than example above which is "text"):

    <input data-val="true" data-val-date="The field Birth Date must be a date." id="BirthDate" name="BirthDate" type="date" value="04/06/1950" />

    MVC

    <p>$('#BirthDate').kendoDatePicker();</p>

    In Edge, the field is blank, even if emulation is changed to IE11. Run this in real IE11, Chrome or Firefox and it works as expected.

    Remove type="date" and it works in Edge. 

    This is a jsFiddle you can try in Edge then IE11: https://jsfiddle.net/gardavis/u3pyo66n/

    Thanks,

    Gary

     

     

     

     

     

     

  5. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 11 Jan Link to this post

    Hi Gary,

    MS Edge accepts date values only in "yyyy-MM-dd" format. If you remove the DatePicker initialization statement in your demo, the textbox value will still be cleared by the browser. That's why, please use type="text". If you are using the DatePicker MVC wrapper in your actual application, then make sure you have correctly upgraded the Kendo UI MVC assembly.

    Regards,
    Dimo
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Gary Davis
    Gary Davis avatar
    71 posts
    Member since:
    Oct 2003

    Posted 11 Jan in reply to Dimo Link to this post

    In the jsFiddle demo, I changed the initialization to be value="1950-04-06" but it still failed to initialize the control. In any case, I do not pass the value as a string but as a DateTime object and the control generates the date as a string in the value attribute. 

    I can't change the input element type="date" to type="text" since the element is generated by the Kendo control.

    And yes, when Kendo is updated in the project, the css, js and wrapper dll are all updated.

    Thanks for looking at this Dimo but I am still looking for a resolution, ideally a fixed Kendo build.

     
  7. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 13 Jan Link to this post

    Hi Gary,

    >> "I can't change the input element type="date" to type="text" since the element is generated by the Kendo control."

    The input type depends on the Kendo.Mvc.dll version. If "date" type is rendered, this indicates that the Kendo.Mvc.dll is version is older than 2015.2.902, which is the first version to resolve the problem. Please double-check.

    Regards,
    Dimo
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Gary Davis
    Gary Davis avatar
    71 posts
    Member since:
    Oct 2003

    Posted 13 Jan in reply to Dimo Link to this post

    Thanks. I will upgrade the dll from what I currently have (2015.2.729) to the current version (2016.1.112) and try again.

     

    Gary

  9. Gary Davis
    Gary Davis avatar
    71 posts
    Member since:
    Oct 2003

    Posted 13 Jan in reply to Gary Davis Link to this post

    After upgrading the project to the 2016 Q1 MVC Kendo, the DatePicker problem is resolved.

    Thanks again,

    Gary

Back to Top
UI for ASP.NET MVC is VS 2017 Ready