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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ValueChanged causes compiler error "Cannot Convert from 'method group' to 'EventCallBack'

Thread ID:

Created:

Updated:

Platform:

Replies:

148455 Oct 21,2019 06:31 AM UTC Oct 23,2019 07:02 AM UTC Blazor 3
loading
Tags: DateRangePicker
J. Scott
Asked On October 21, 2019 06:31 AM UTC

Hi,

I am attempting to use the DateRangePicker control in a ServerSide Blazor application. When I attempt to configure the ValueChanged event as per the SyncFusion Documentation on Dynamic Values, I receive an error that "Cannot convert from 'method group' to 'EventCallback'. I am using the 17.3.0.17 version of the SyncFusion Blazor components and tried on .NET Core 3.0 Preview 9 and even updated to the .NET Core 3.1 Preview 1 and the problem persists.

<EjsDateRangePicker Placeholder="Choose a Range" StartDate="@CheckIn" EndDate="@CheckOut" ValueChanged="@onDateChange"></EjsDateRangePicker>


 private void onDateChange(RangeEventArgs args)

    {

        CheckIn = args.StartDate;

        CheckOut = args.EndDate;

        StateHasChanged();


    }



Narayanasamy Panneer Selvam [Syncfusion]
Replied On October 22, 2019 07:07 AM UTC

Hi Scott,

 
Greetings from Syncfusion support.

 
We have validated the shared code example. From that we noticed, you may be faced an error due to improper approach of event binding. We have provided tag support for event binding. Kindly follow the below mentioned code example to resolve your issue.

Code example:
 
<EjsDateRangePicker ID="date-range"> 
    <DateRangePickerEvents ValueChange="@valueChange"></DateRangePickerEvents> 
</EjsDateRangePicker> 
 
@code { 
public void valueChange(Syncfusion.EJ2.Blazor.Calendars.RangeEventArgs args) 
{ 
  this.Data.Add(new PlaylistItemModel() { Title = "Change Eventtriggered" }); 
  this.StateHasChanged(); 
 
} 
} 

Also, we suggest you to use ValueChange event instead of using ValueChanged. Let us know if you need further assistance on this. 

Regards,
Narayanasamy P.
 



J. Scott
Replied On October 22, 2019 02:30 PM UTC

I will give this a try. Please note that this approach is different from the guidance provided by the documentation: https://ej2.syncfusion.com/blazor/documentation/daterangepicker/data-binding/

ValueChange is not an option on the EjsDateRangePicker component which is why I used ValueChanged as it was the only option that was similar to the documentation.

From the documentation:
@using Syncfusion.EJ2.Blazor.Calendars

<p>DateRangePicker StarteDate and EndDate is: <strong> @StartValue </strong> and <strong> @EndValue </strong></p>

<EjsDateRangePicker StartDate="@StartValue" EndDate="@EndValue" ValueChange="@onChange"></EjsDateRangePicker>

@code {

public DateTime StartValue { get; set; } = DateTime.Now;

public DateTime EndValue { get; set; } = DateTime.Now;

private void onChange(RangeEventArgs args)
{
    StartValue = args.StartDate;
    EndValue = args.EndDate;
    StateHasChanged();
}
}

Narayanasamy Panneer Selvam [Syncfusion]
Replied On October 23, 2019 07:02 AM UTC

Hi Scott,


Sorry for the in convenience caused.

We have already considered the Ug documentation refresh internally. The changes will be refresh with our upcoming patch release, which is schedule to release on end of October, 2019. We appreciate your patience until then.


Regards,
Narayanasamy P. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon