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 and it can be synchronous (return void), or it can also be asynchronous and return async Task.

See Also

In this article