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

Dynamic Binding on DateRangePicker generates a complile error

Thread ID:

Created:

Updated:

Platform:

Replies:

151173 Feb 3,2020 04:03 AM UTC Feb 4,2020 05:43 AM UTC Blazor 3
loading
Tags: DateRangePicker
Bob Troppmann
Asked On February 3, 2020 04:03 AM UTC

Hi,

Using 17.4.0.46 in a blazor server side project, getting a compile error when trying to use the daterangepicker control:

Error CS1503 Argument 2: cannot convert from 'method group' to 'EventCallback'

I tried using the sample code on the documentation website, on a fresh project, pasting in the following sample code from the website into the index.razor page.

@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();
}
}

Bob


Sureshkumar P [Syncfusion]
Replied On February 3, 2020 12:54 PM UTC

Hi Bob, 
 
Greetings from Syncfusion support. 
 
We have validated your requirement. we suspect that you have tried the evening binding in our normal component property binding tag. We suggest you bind the event in the DateRangePickerEvents tag to get rid of your facing issue. 
 
Kindly refer the below code example. 
<EjsDateRangePicker StartDate="@StartValue" EndDate="@EndValue"> 
    <DateRangePickerEvents ValueChange="@onChange"></DateRangePickerEvents> 
</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(); 
} 
} 
 
 
 
Also, we have corrected the our documentation. It will be refreshed end of this week. We will update you once the document has been refreshed. We appreciate your patience until then. 
 
Regards, 
Sureshkumar P 


Bob Troppmann
Replied On February 3, 2020 05:58 PM UTC

This fixed my issue.

Thanks for the quick reply.

Bob

Sureshkumar P [Syncfusion]
Replied On February 4, 2020 05:43 AM UTC

Hi Bob, 
 
Thanks for the update. Please get back to us if you require further assistance on this. We will be happy to assist you. 
 
Regards, 
Sureshkumar 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