【发布时间】:2013-11-19 00:56:38
【问题描述】:
如果 ViewBag.ServerId 中的值然后设置为 2,我想将以下下拉列表设置为某个值
<script type="text/javascript">
$(document).ready(function () {
var data = [
{ text: "Selection 1", value: "1" },
{ text: "Selection 2", value: "2" }
];
$("#Cust").kendoDropDownList({
dataTextField: "text",
dataValueField: "value",
dataSource: data,
index: 0,
optionLabel: {
text: "Please Select",
value: ""
}
});
var dropdownlist = $("#Cust").data("kendoDropDownList");
});
</script>
<div>
@if (ViewBag.serverId == 3)
{
so i would like to do something like this however i could reference dropdownlist.
dropdownlist.select(dropdownlist.ul.children().eq(2));
}
else
{
}
</div>
【问题讨论】: