我正在使用 kendo UI dropdownlist,我是 kendo UI 的新手。如果 @TrackingHelper.CurrentUser.IsViewTestCallType 返回 False,我想禁用下拉列表。
@(Html.Kendo().DropDownListFor(i => i.CallTypeId)
.Name("CallTypeId")
.HtmlAttributes(new { style = "width:100%" })
.DataTextField("MasterValueName")
.DataValueField("MasterValueId")
.Events(x => x.Open("ManageSecurity"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCallType", "Common", new { Area = "" });
});
})
.OptionLabel("Select Call Type")
)
我在 jquery 中执行此操作:
$(document).ready(function ()
{
debugger;
var result = '@TrackingHelper.CurrentUser.IsViewTestCallType';
if (result == "False")
{
$("#CallTypeId").prop("disabled", true);
}
});
任何建议将不胜感激。提前致谢。
最佳答案
使用小部件的启用方法。
$("#CallTypeId").data("kendoDropDownList").enable(false);
关于jquery - 如何使用jquery禁用kendo ui下拉列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34763554/