任何人都可以帮助如何使用Html.Kendo().CheckBoxFor(m => m.Enable)中的事件 [英] Can anyone help how to use event from Html.Kendo().CheckBoxFor(m => m.Enable)
问题描述
我是剑道新手.我在MVC cshtml中使用Html.Kendo().CheckBoxFor(m => m.Enable)
,但无法为此复选框添加更改事件. Html.Kendo().DropDownListFor
具有.Events(e => e.Change("PopulateCountry"))
,但是我没有在CheckBox
中看到相同类型的事件.
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
.
任何人都可以帮忙吗?
推荐答案
Html.Kendo().CheckBoxFor
帮助器呈现一个常规的html5复选框.它实际上不是像Html.Kendo().DropDownListFor
创建的kendo小部件.我相信这就是为什么CheckBox
的帮助程序缺少.Events
选项的原因.
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.
无论如何,您都可以使用.HtmlAttributes
选项将更改处理程序添加到复选框元素:
Regardless, you can use the .HtmlAttributes
option to add a change handler to the checkbox element instead:
.HtmlAttributes(new { onchange = "PopulateCountry();" })
这篇关于任何人都可以帮助如何使用Html.Kendo().CheckBoxFor(m => m.Enable)中的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!