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

ValueChange event seems broken

Hi,

I can see from the latest release that the EjsDatePicker has undergone a few changes (along with DropDownList and a few other controls - all issue swith which I have fixed), it's the ValueChange event which is now in the DatePickerEvents section of the control, and no longer in the main element which is causing me problems.

Anyway, as well as introducing TValue for templating and needing this on the ValueChange event, it does not seem to compile for me. (I have updated to the latest version of everything from .net core SDK and syncfusion packages.

Here is my code:
<EjsDatePicker TValue="DateTime?" Placeholder="Start Date" FloatLabelType="FloatLabelType.Always" Format="dd/MM/yyyy" AllowEdit="false" Readonly="false" Value="@DateTime.Now.Date">
    <DatePickerEvents ValueChange="DateChanged"></DatePickerEvents>
</EjsDatePicker>
@code {
    protected async Task DateChanged(Syncfusion.EJ2.Blazor.Calendars.ChangedEventArgs<DateTime?> args)
    {
        if (args.IsInteracted)
        {
            // do something here
        }
    }
}

When I try to compile I get "Argument 2: cannot convert from 'method group' to 'EventCallback' " on the <DatePickerEvents> line in the code.

Any Ideas what I am doing wrong?



3 Replies

SD Saranya Dhayalan Syncfusion Team December 18, 2019 04:56 AM UTC

Hi Matthew, 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported issue, cause of the issue is you need to add the TValue to DatePickerEvents. Please find the below code snippet: 
 
@using Syncfusion.EJ2.Blazor.Calendars 
@using Syncfusion.EJ2.Blazor.Inputs 
 
<EjsDatePicker TValue="DateTime?" Placeholder="Start Date" FloatLabelType="FloatLabelType.Always" Format="dd/MM/yyyy" AllowEdit="false" Readonly="false" Value="@DateTime.Now.Date"> 
    <DatePickerEvents TValue="DateTime?" ValueChange="DateChanged"></DatePickerEvents> 
</EjsDatePicker> 
@code { 
    protected async Task DateChanged(Syncfusion.EJ2.Blazor.Calendars.ChangedEventArgs<DateTime?> args) 
    { 
        if (args.IsInteracted) 
        { 
            // do something here 
        } 
    } 
} 
 
Please find the release notes for the DatePicker ValueChange event 
 
 
Could you please check the above code snippet and get back to us if you need further assistance on this? 
 
Regards, 
Saranya D 



MA Matthew December 18, 2019 09:52 AM UTC

Hi,

Thanks again for you help, adding in the TValue parameter has done the trick.



SD Saranya Dhayalan Syncfusion Team December 18, 2019 10:08 AM UTC

Hi Matthew 
 
Most Welcome.  
 
Please let us know, if you need any further assistance on this.  
 
Regards, 
Saranya D 


Loader.
Live Chat Icon For mobile
Up arrow icon