We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Binding to property is failing

Hi, I have this problem with DatePicker component, whenever I try to bind to value of DateTime of a type it gives me error

here is my definition :

   <td class="text-left"><EjsDatePicker Readonly="true"  @bind-Value="@myEntity.DocDate"  /></td>

and

public DTO myEntity { get; set; }

and   
public DateTime DocDate { get; set; } = DateTime.Today;

the error is :

Error    CS1503    Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<System.DateTime>' to 'Microsoft.AspNetCore.Components.EventCallback'


1 Reply

SD Saranya Dhayalan Syncfusion Team December 17, 2019 06:08 AM UTC

Hi Waleed, 
 
Thank you for contacting Syncfusion support, 
 
The default value in our Datepicker Value property is Null. Default DateTime value is “1/1/0001 12:00:00 AM”. It’s set to the invalid date for Datepicker component. So, you need to specify nullable type of DateTimeIn our volume-4 release, we will provide support for the generic type (TValue). Please find the below code snippet. 
@using Syncfusion.EJ2.Blazor.Calendars 
 
    <td class="text-left"><EjsDatePicker Readonly="true" @bind-Value="@myEntity.DocDate" /></td> 
 
 
@code { 
       
    public DateTime? DocDate { get; set; } = DateTime.Today; 
      
} 
 
Please find the below documentation link: 
 
Could you please check the above code snippet and get back to us if you need further assistance on this? 
 
Regards, 
Saranya D 


Loader.
Live Chat Icon For mobile
Up arrow icon