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

DateRange selection

Thread ID:

Created:

Updated:

Platform:

Replies:

148870 Nov 6,2019 05:42 PM UTC Nov 7,2019 10:07 AM UTC Blazor 1
loading
Tags: DateRangePicker
Alex Whittle
Asked On November 6, 2019 05:42 PM UTC

I have a server side Blazor application and trying to use the DateRangePicker control and using the following 

 <DateRangePickerEvents ValueChange="@valueChangeAsync"></DateRangePickerEvents>

 private async Task valueChangeAsync(Syncfusion.EJ2.Blazor.Calendars.RangeEventArgs args)
   {

        DateFrom = args.StartDate;
        DateTo = args.EndDate;

}

I am able to initially set DateFrom  and DateTo but valueChangeAsync is called multiple times and resets to the default values.

Any ideas?

Narayanasamy Panneer Selvam [Syncfusion]
Replied On November 7, 2019 10:07 AM UTC


Greetings from Syncfusion support.

 
We have validated your issue from the shared code example. We were unable to reproduce the reported issue. 
We suspect that you may tried to update StartDate and EndDate value through change event. If you want to get updated value for StartDate and EndDate for every value change. Use two-way binding for respective property as follows, 
    <EjsDateRangePicker Value="@dateArray" @bind-StartDate="@DateFrom" @bind-EndDate="@DateTo"> 
        <DateRangePickerEvents ValueChange="@valueChangeAsync"></DateRangePickerEvents> 
    </EjsDateRangePicker> 
 
@code{ 
 
    public DateTime? DateFrom { get; set; } = DateTime.Now; 
    public DateTime? DateTo { get; set; } = new DateTime(2019, 11, 30); 
    public DateTime[] dateArray = new DateTime[2] { DateTime.Now, new DateTime(2019, 11, 30) }; 
    private async Task valueChangeAsync(Syncfusion.EJ2.Blazor.Calendars.RangeEventArgs args) 
    { 
 
        Console.WriteLine(DateFrom); 
        Console.WriteLine(DateTo); 
 
    } 
 
} 
 
Kindly let us know if you need further assistance on this.

 
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