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

Dynamic Binding on DateRangePicker generates a complile error


Using 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;


3 Replies

SP Sureshkumar P Syncfusion Team 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> 
@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; 
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. 
Sureshkumar P 

BT Bob Troppmann February 3, 2020 05:58 PM UTC

This fixed my issue.

Thanks for the quick reply.


SP Sureshkumar P Syncfusion Team 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. 
Sureshkumar P 

Live Chat Icon For mobile
Up arrow icon