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
close icon

On Change Binding and Disable user entry

Hello,
I connected the OnChange event on the DatePicker but it is not firing. Do you have an example of this. Just need to get a call back when the user selects a new date.
I also want to disable the ability of the user to type in a date. I want to force them to open the datepicker to select a date.
Thanks,
Ryan

1 Reply

BC Berly Christopher Syncfusion Team August 12, 2019 11:20 AM UTC

Hi Ryan, 
  
  
Greetings from Syncfusion support. 
  
  
We would like to inform you that bind the change event name as “ValueChange” and we suggest you to use our public API “AllowEdit” as “false” to disable typing in the DatePicker input and select the date only from the DatePicker popup as mentioned in the below code example.  
  
[index.razor] 
  
<EjsDatePicker Value="@DateValue" ValueChange="@onChange" AllowEdit="false"></EjsDatePicker> 
<p>DatePicker Value is: @DateValue</p> 
@code { 
  
    public DateTime? DateValue { get; set; } = DateTime.Now; 
  
  
    private void onChange(Syncfusion.EJ2.Blazor.Calendars.ChangedEventArgs args) 
    { 
        DateValue = args.Value; 
    } 
} 
  
  
Please find the sample from the below link. 
  
  
  
To know more about DatePicker component, please refer the below documentation link.  
  
  
  
Regards, 
Berly B.C 


Loader.
Live Chat Icon For mobile
Up arrow icon