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

Button Events

This article explains the events available in the Telerik Button for Blazor:

OnClick

The OnClick event fires when the user clicks or taps the button.

It receives argument of type MouseEventArgs.

Handle the button click

@result
<br />
@moreInfo

<br />
<TelerikButton OnClick="@OnClickHandler">Click me!</TelerikButton>

@code {
    string result;
    string moreInfo;

    async Task OnClickHandler(MouseEventArgs args)
    {
        result = "Button was clicked at: " + DateTime.Now.ToString();
        moreInfo = "Ctrl was pressed when clicked: " + args.CtrlKey;
    }
}

The event is an EventCallback. It can be synchronous and return void, or asynchronous and return async Task. Do not use async void.

See Also

In this article