Search code examples
kendo-uikendo-tabstripkendo-datepicker

Problems with current date using a date picker inside a tabstrip


I have this code:

<input id="Text1" maxlength="10" />

<script>
    $("#Text1").kendoDatePicker({ value: new Date() });
</script>

It's displayed OK with the current date, but if I put the same item inside of a Kendo UI Tabstrip the current date is not displayed. How could I fix it?

This is the code with the issue:

<div id="tabstrip" class="tabstrip" style="height:100%">
<ul>                                         
   <li> <asp:label  ID="tab1"   runat="server" Text="Description" /> </li>                                           
   <li> <asp:label  ID="tab2"   runat="server" Text="Data" /> </li>                                           
</ul>
<div id="Description">
   <input id="Text1" maxlength="10" />
</div>
<div></div>
</div>

<script>
   $("#Text1").kendoDatePicker({ value: new Date() });

 var tabstrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");            

</script>

Solution

  • I'm not sure the reasons about this issue but it was fixed with this code:

    <script>
      var todayDate = kendo.toString(kendo.parseDate(new Date()), 'MM/dd/yyyy');
      $("#Text1").data("kendoDatePicker").value(todayDate);
    
      var tabstrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");            
    
    </script>