New to Telerik UI for Blazor? Download free 30-day trial

Events

The events exposed for the Telerik TextArea for Blazor let you react to user actions and input. This article explains the events available in the Telerik TextArea.

OnChange

The OnChange event represents a user action - confirmation of the current value. It fires when the user presses Enter in the input, or when the input loses focus. The OnChange event does not prevent you from using two-way data binding.

Handle OnChange event

@TextAreaValue
<br />
<TelerikTextArea @bind-Value="@TextAreaValue"
                 OnChange="@OnChangeHandler">
</TelerikTextArea>

@code {
    public string TextAreaValue { get; set; }

    public void OnChangeHandler(object input)
    {
        Console.WriteLine($"The OnChange event fired with {input as string}");
    }
}

The event is an EventCallback and it can be synchronous (return void), or it can also be asynchronous and return async Task.

ValueChanged

The ValueChanged event fires upon every change (for example, keystroke) in the input. When using the ValueChanged event you can not use two-way data binding, because the @bind-Value internally fires this event.

Handle ValueChanged event

@TextAreaValue
<br />
<TelerikTextArea Value="@TextAreaValue"
                 ValueChanged="@ValueChangedHandler">
</TelerikTextArea>

@code {
    public string TextAreaValue { get; set; }

    public void ValueChangedHandler(string input)
    {
        // you have to update the model manually because handling the ValueChanged event does not let you use @bind-Value
        TextAreaValue = input;
        Console.WriteLine($"The ValueChange event fired with {input}");
    }
}

The event is an EventCallback and it can be synchronous (return void), or it can also be asynchronous and return async Task.

See Also

In this article
Not finding the help you need? Improve this article