Events
This article explains the events available in the Telerik DateInput for Blazor:
OnBlur
The OnBlur event fires when the component loses focus.
Handle the OnBlur event
The event is an
EventCallback. It can be synchronous and returnvoid, or asynchronous and returnasync Task. Do not useasync void.
OnChange
The OnChange event represents a user action that confirms the current value. It fires when the user presses Enter in the input or when the input loses focus.
The event handler receives an object argument that you need to cast to the actual Value type. The argument can hold a value or be null, depending on the user input and the Value type.
The DateInput is a generic component, so you must either provide a Value, or a type to the T parameter of the component.
Handle OnChange and use two-way binding
The event is an
EventCallback. It can be synchronous and returnvoid, or asynchronous and returnasync Task. Do not useasync void.
The
OnChangeevent is a custom event and does not interfere with bindings, so you can use it together with models and forms.
ValueChanged
The ValueChanged event fires:
- During typing when the resulting input value is valid.
- On input blur if the input value is not valid and the
Valuetype is nullable.
Handle ValueChanged and provide initial value
The event is an
EventCallback. It can be synchronous and returnvoid, or asynchronous and returnasync Task. Do not useasync void.
The lambda expression in the handler is required by the framework: https://github.com/aspnet/AspNetCore/issues/12226.