Events
The Switch for ASP.NET MVC exposes the Change()
event that you can use for capturing the Switch's value during user interaction.
For a complete example on Switch events, refer to the demo on using the events of the Slider.
Handling by Handler Name
The following example demonstrates how to subscribe to events by a handler name.
@(Html.Kendo().Switch()
.Name("switch")
.Events(e => e
.Change("change")
)
)
<script>
function change(e) {
// Handle the change event.
}
</script>
Handling by Template Delegate
The following example demonstrates how to subscribe to events by a template delegate.
@(Html.Kendo().Switch()
.Name("switch")
.Events(e => e
.Change(@<text>
function(e) {
// Handle the change event inline.
}
</text>)
)
)