javascript - 访问 Kendo UI MVC RadioButtonFor Helper 的 JavaScript 控件

标签 javascript model-view-controller kendo-ui

我正在使用 KendoUI 进行 MVC。我使用 RadioButtonFor 帮助器创建了一些 RadioButtons。所有 KendoUI 都有一个 JavaScript Controller ,用于管理您可以访问的每个控件的客户端方面。

例如:MVC 网格助手

// MVC HELPER
@(Html.Kendo().Grid<SomeDataItem>().Name("SomeGrid") ...other stuff... )

// Grid
var control = $('#SomeGrid')).data('kendoGrid')

...now I can use "control" to set events or do othjer things for the Grid.

我需要:
我需要为 RadioButton 控件客户端设置一些事件和其他内容。

// MVC HELPER
@(Html.Kendo().RadioButtonFor(model => model.Entity.Meter.FlowTypeId)
              .Label("Initial")
              .Value(1))
@(Html.Kendo().RadioButtonFor(model => model.Entity.Meter.FlowTypeId)
              .Label("Reconnect/Resumed")
              .Value(2))

问题:
如何访问这些单选按钮的“Kendo UI Control”?

正常方法不起作用: $('#Entity_Meter_FlowTypeId_1').data() //<-- empty

...这通常会给您一个数据内容列表。

最佳答案

Kendo 没有用于单选按钮的客户端 API。

这是因为它只是一个带有标签的单选按钮,因此除了普通的 javascript 事件之外,没有可以绑定(bind)的自定义事件。您可以使用 javascript/jquery 绑定(bind)到这些事件,因此将这些相同的事件添加到 kendo 对象中没有实际意义。

设置属性也受到限制(文本/选中/?),并且这些可以再次使用普通 JS 轻松处理。

您唯一能做的就是设置单选按钮的样式,如 the Telerik site 中所述。 .

关于javascript - 访问 Kendo UI MVC RadioButtonFor Helper 的 JavaScript 控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47358617/

相关文章:

javascript - jQuery 淡入事件元素,淡出非事件元素

javascript - 重定向完成后执行 javascript

javascript - 从 JavaScript 中同步导入 JavaScript 文件?

model-view-controller - MVC - 从另一个模型引用模型

jquery - Kendo Treeview/jQuery : Looping through children of children in unordered list

javascript - 将 mongoose 返回结果分配给 Node js 变量

android - Android 中 MVP 相对于 MVVM 设计模式的缺点

java - Java应用程序中的MVC模式

javascript - Kendo Tabstrip 使用 MVVM 在左侧显示选项卡

javascript - 循环结束后调用循环内的函数