Search code examples
kendo-uikendo-asp.net-mvc

Can anyone help how to use event from Html.Kendo().CheckBoxFor(m => m.Enable)


I am new to Kendo. I am using Html.Kendo().CheckBoxFor(m => m.Enable) in MVC cshtml, and I'm unable to add a change event for this checkbox. The Html.Kendo().DropDownListFor has .Events(e => e.Change("PopulateCountry")), but I dont see same type of event in CheckBox.

Can anyone help on this?


Solution

  • The Html.Kendo().CheckBoxFor helper renders a regular html5 checkbox. It is not actually a kendo widget like Html.Kendo().DropDownListFor creates. I believe this is why the helper for CheckBox is lacking an .Events option.

    Regardless, you can use the .HtmlAttributes option to add a change handler to the checkbox element instead:

    .HtmlAttributes(new { onchange = "PopulateCountry();" })