New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Defines the fluent API for configuring the Kendo UI Switch for ASP.NET MVC events.

Definition

Constructors

Initializes a new instance of the SwitchEventBuilder class.

C#
public SwitchEventBuilder(IDictionary<string, object> events)
Parameters:eventsIDictionary<string, object>

The Switch event handlers.

Methods

Defines the handler of the Change client-side event. Fires when the checked state of the Switch is changed through user interaction.

C#
public SwitchEventBuilder Change(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

SwitchEventBuilder

Returns the current instance of SwitchEventBuilder .

Example:
C#
@(Html.Kendo().Switch()
.Name("switch")
.Events(events =&gt; events.Change(@&lt;text&gt;
function(e) {
// Handle the Change event
}
&lt;/text&gt;)
)
)

Defines the handler of the Change client-side event. Fires when the checked state of the Switch is changed through user interaction.

C#
public SwitchEventBuilder Change(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Change event.

Returns:

SwitchEventBuilder

Returns the current instance of SwitchEventBuilder .

Example:
C#
@( Html.Kendo().Switch()
.Name("switch")
.Events(events =&gt; events
.Change("onChange")
)
)

Defines the handler of the KendoKeydown client-side event. Triggered when the user presses a keyboard key while the Switch is focused.The event handler function context (available via the this keyword) will be set to the widget instance.

C#
public SwitchEventBuilder KendoKeydown(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

SwitchEventBuilder

Returns the current instance of SwitchEventBuilder .

Defines the handler of the KendoKeydown client-side event. Triggered when the user presses a keyboard key while the Switch is focused.The event handler function context (available via the this keyword) will be set to the widget instance.

C#
public SwitchEventBuilder KendoKeydown(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the KendoKeydown event.

Returns:

SwitchEventBuilder

Returns the current instance of SwitchEventBuilder .