Completed
Last Updated: 20 Dec 2024 13:21 by Dan
Release 2025 Q1 (Feb)
SturmA
Created on: 19 Nov 2024 08:51
Category: UI for ASP.NET Core
Type: Bug Report
2
Pickers are not bound to model value when a nullable DateTime is set

Bug Report

The Pickers are not bound to model value when a nullable DateTime is set.

Reproduction of the problem

  1. Create a model with a nullable DateTime property
         public class MyModel
         {
               public DateTime? Birthday { get; set; }
         }
    
  2. Declare either a DatePickerFor, DateRangePickerFor, DateInputFor, or TimePickerFor Helpers
        @(Html.Kendo().TimePickerFor(m => m.Birthday))
    
  3. Notice, that the value has not been bound accordingly.

Current behavior

The Pickers are not bound to model value when nullable.

Expected behavior

The Pickers are not bound to model value when a nullable DateTime is set.

Environment

Kendo UI version: 2024.4.1112
jQuery version: x.y
Browser: [all]

4 comments
Dan
Posted on: 20 Dec 2024 13:21
The workaround throws an error if using Telerik.UI.for.AspNet.Core 2024.4.1112.  Is  that expected?
ADMIN
Ivaylo
Posted on: 20 Dec 2024 10:22

Hello Renu,

This bug is already fixed. The fix will come live with the next release:
https://github.com/telerik/kendo-ui-core/issues/8053

There is also a workaround solution. Instead of using the picker with the For suffix, such as DatePickerFor(), the approach should involve utilizing DatePicker() and manually setting the Name and Value properties. Below is an example of the implementation: 
@model MyPageModel

@Html.Kendo().DatePicker().Name("MyDateProperty").Value(Model.MyDateProperty)

I hope this information was helpful.

Kind Regards,
Ivaylo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Renu
Posted on: 15 Dec 2024 06:09
Don't we have any workaround for this at the moment?
Dan
Posted on: 08 Dec 2024 21:43
Please get this fixed and released.  and add this scenario to your test cases as this kind of bug kills us when we don't notice it for you, but our clients do.  I have to revert to previous edition.