Getting "cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<System.DateTime>' to 'Microsoft.AspNetCore.Components.EventCallback'"

Hello!

I'm trying to use DateRangePicker.
When i'm trying to set @bind-StartDate and @bind-EndDate:
<EjsDateRangePicker Placeholder="Subscription Date" Min="@DateTime.Now" Format="dd.MM.yyyy" @bind-StartDate="@_startDate" @bind-EndDate="@_endDate"></EjsDateRangePicker>

I getting error dyring compilation:
Cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<System.DateTime>' to 'Microsoft.AspNetCore.Components.EventCallback'

If i remove binding
<EjsDateRangePicker Placeholder="Subscription Date" Min="@DateTime.Now" Format="dd.MM.yyyy" ></EjsDateRangePicker>

Everything is ok.

1 Reply

SN Sevvandhi Nagulan Syncfusion Team March 6, 2020 06:11 AM UTC

Hi Aleksandrs, 

Greetings from Syncfusion support. 

We have checked the reported requirement. We would like to inform that StartDate and EndDate is Nullable type. You have defined the StartDate and EndDate without nullable. It is the cause of the issue. Kindly refer the below code snippet 

<EjsDateRangePicker  Placeholder="Subscription Date" Min="@DateTime.Now" Format="dd.MM.yyyy" @bind-StartDate="@_startDate" @bind-EndDate="@_endDate"></EjsDateRangePicker> 
 
 
    public DateTime? _startDate { get; set; } = DateTime.Now; 
 
    public DateTime? _endDate { get; set; } = DateTime.Now; 
} 

Please find the sample below, 


Regards, 
Sevvandhi N 


Loader.
Up arrow icon