使用复选框禁用 kendo mvc 下拉列表
disable kendo mvc dropdownlist using checkbox
我有一个复选框,选中时应启用 Kendo MVC DropdownList,未选中时应禁用 DropdownList。但是我做不到,有问题。你能建议我如何解决这个问题吗?
<input type="checkbox" onclick="if (this.checked) { document.getElementById('ParentDeptDrp').disabled = true; } else { document.getElementById('ParentDeptDrp').disabled = false; }" />
Is Product/Service?
<br />
@(Html.Kendo().DropDownList()
.Name("ParentDeptDrp")
.DataTextField("DeptName")
.DataValueField("DeptName")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetParentDeptt", "Department");
})
.ServerFiltering(true);
})
.SelectedIndex(1)
//.Enable(false)
)
尝试
function setDDL(chk){
var dropdownlist = $("#ParentDeptDrp").data("kendoDropDownList");
dropdownlist.enable(chk);
};
HTML
<input type="checkbox" onclick="setDDL(this.checked);" />
http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#configuration-enable
我有一个复选框,选中时应启用 Kendo MVC DropdownList,未选中时应禁用 DropdownList。但是我做不到,有问题。你能建议我如何解决这个问题吗?
<input type="checkbox" onclick="if (this.checked) { document.getElementById('ParentDeptDrp').disabled = true; } else { document.getElementById('ParentDeptDrp').disabled = false; }" />
Is Product/Service?
<br />
@(Html.Kendo().DropDownList()
.Name("ParentDeptDrp")
.DataTextField("DeptName")
.DataValueField("DeptName")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetParentDeptt", "Department");
})
.ServerFiltering(true);
})
.SelectedIndex(1)
//.Enable(false)
)
尝试
function setDDL(chk){
var dropdownlist = $("#ParentDeptDrp").data("kendoDropDownList");
dropdownlist.enable(chk);
};
HTML
<input type="checkbox" onclick="setDDL(this.checked);" />
http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#configuration-enable