我有一个两个kendo下拉列表,可以选择State来进行页面上的地址输入。我有一个复选框将第一个地址复制到第二个地址。我需要能够引用和设置kendo下拉列表的值。
下拉列表:
@(Html.Kendo().DropDownListFor(m => m.physicalAddress.State)
.Name("physicalAddress.State")
.DataTextField("name")
.DataValueField("value")
.OptionLabel("Physical State")
.BindTo((System.Collections.IEnumerable)ViewData["StateList"]))
@(Html.Kendo().DropDownListFor(model => model.mailingAddress.State)
.Name("mailingAddress.State")
.DataTextField("name")
.DataValueField("value")
.OptionLabel("Mailing State")
.BindTo((System.Collections.IEnumerable)ViewData["StateList"]))
我试图写的功能:
function copyInfo(f) {
if (document.getElementById("copyCheckBox").checked) {
//I'm hoping something exists like this
[SecondDropDown].value = [FirstDropDown].value;
}
}
答案 0 :(得分:0)
试试这个:
#fixed-navigation
其中dropdownlist1和dropdownlist2是包含元素的DOM ID。
请参阅API DEMO:http://demos.telerik.com/kendo-ui/dropdownlist/api
有价值的文档():http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#methods-value