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

SplitButton Events

This article describes the SplitButton events:

OnClick

The OnClick event fires when the user clicks or taps the primary button or a secondary button. Each SplitButton action can execute a separate OnClick handler.

  • The event argument type is MouseEventArgs.
  • The event handler can be synchronous (void) or asynchronous (async Task).

SplitButton OnClick event

<TelerikSplitButton OnClick="@OnReply">
    <SplitButtonContent>Reply</SplitButtonContent>
    <SplitButtonItems>
        <SplitButtonItem OnClick="@OnReplyAll">Reply All</SplitButtonItem>
    </SplitButtonItems>
</TelerikSplitButton>

Last action: <strong> @LastAction </strong>
at <strong> @ClickTimeString </strong>.

@code {
    string LastAction { get; set; } = "...";
    string ClickTimeString { get; set; } = "...";

    void OnReply(MouseEventArgs args)
    {
        LastAction = "Reply (sync)";
        DateTime now = DateTime.Now;
        ClickTimeString = $"{now.ToLongTimeString()}.{now.Millisecond}";
    }

    async Task OnReplyAll(MouseEventArgs args)
    {
        DateTime now = DateTime.Now;
        await Task.Delay(300);
        LastAction = "Reply All (async)";
        ClickTimeString = $"{now.ToLongTimeString()}.{now.Millisecond}";
    }
}

Next Steps

See Also

In this article