Search results

Overview

You can define the native event using on event attribute in component. The value of attribute is treated as an event handler. The event specific data will be available in event arguments.

The different event argument types for each event are,

  • Focus Events - UIFocusEventArgs
  • Mouse Events - UIMouseEventArgs
  • Keyboard Events - UIKeyboardEventArgs
  • Touch Events – UITouchEventArgs

List of Native events supported

We have provided the following native event support to the DropDownButton component:

List of Native events
onclick onblur onfocus onfocusout
onmousemove onmouseover onmouseout onmousedown
ondblclick onkeydown onkeyup onkeypress
ontouchend onfocusin onmouseup ontouchstart

How to bind click event to DropDownButton

The onclick attribute is used to bind the click event for DropDownButton. Here, we have explained about the sample code snippets of dropdown button.

@using Syncfusion.EJ2.Blazor.SplitButtons

<EjsDropDownButton Items="@Items" @onclick="onClick">Profile</EjsDropDownButton>

@code {
  public List<ItemModel> Items = new List<ItemModel>
  {
    new ItemModel{ Text = "Dashboard" },
    new ItemModel{ Text = "Notifications" },
    new ItemModel{ Text = "User Settings" },
    new ItemModel{ Text = "Log Out" }
  };

  private void onClick(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
  {
         //onclick Event triggered
  }
}