【发布时间】:2025-12-07 10:25:01
【问题描述】:
我创建了DropDownList 和EnumDropDownList。
DropDownList 中的每个选项在EnumDropDownList 上都有一个同名的选项。
我选择了用户从DropDownList 中选择的一个选项,我想更新EnumDropDownList 这个特定选项是由用户选择的。
我的 DropDownList 有一个 ID (id="ImageTypeDropDown")
我的EnumDropDownList 有一个id ("id="FileTypeDropDown")
如何修复线路:
document.getElementById('FileTypeDropDown2').options.find(wantedOption).Selected=true;
<script>
function adjustFitted() {
var e = document.getElementById('ImageTypeDropDown');
var wantedOption = e.options[e.selectedIndex].text; // the option user chose - works well:)
document.getElementById('FileTypeDropDown2').options.find(wantedOption).Selected=true;
return false;
}
</script>
【问题讨论】:
标签: javascript c# asp.net asp.net-mvc enumdropdownlistfor