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

DropDownButton Events

The DropDownButton exposes an OnClick event that you can use to initiate an action within the application.

The OnClick event fires when the user clicks or taps the primary button or a secondary button. The primary <TelerikDropDownButton> and each of its <DropDownButtonItem> instances execute a separate OnClick handler.

The event argument type is MouseEventArgs.

The event handler can be synchronous (void) or asynchronous (async Task).

Handling the DropDownButton OnClick event

<br />

<br />
<TelerikDropDownButton Icon="@SvgIcon.Clipboard" OnClick="@((args) => OnItemClick("Primary", args))">

        <DropDownButtonItem Icon="@SvgIcon.ClipboardText" OnClick="@((args) => OnItemClick("Paste Text", args))">Paste Text</DropDownButtonItem>
        <DropDownButtonItem Icon="@SvgIcon.ClipboardCode" OnClick="@((args) => OnItemClick("Paste as HTML", args))">Paste as HTML</DropDownButtonItem>
        <DropDownButtonItem Icon="@SvgIcon.ClipboardMarkdown" OnClick="@((args) => OnItemClick("Paste Markdown", args))">Paste Markdown</DropDownButtonItem>
        <DropDownButtonItem OnClick="@((args) => OnItemClick("Set Default Paste", args))">Set Default Paste</DropDownButtonItem>


@code {
    private string clickedItemInfo;

    private string moreInfo;

    private void OnItemClick(string item, MouseEventArgs args)
        clickedItemInfo = $"User clicked the {item} option.";

        moreInfo = "Ctrl was pressed when clicking the primary button: " + args.CtrlKey;

See Also

In this article