Search results

Change switch state using toggle method

This section explains about how to toggle between the switch states using Toggle method.

@using Syncfusion.EJ2.Blazor.Buttons

<EjsSwitch OffLabel="OFF" OnLabel="ON" Created="create" @ref="SwitchObj"></EjsSwitch>

@code{
    EjsSwitch SwitchObj;
    private void create(object obj)
    {
        SwitchObj.Toggle();
    }
}

Output be like

Switch Sample

Switch triggers OnChange event on every state stage to perform custom operations.