在第一个选择列表中选择了一个选项后,我无法刷新第二个选择列表。我正在使用javascript,网络上没有任何工作。 在我选择第一个列表中的项目之后,如何刷新或激活第二个列表?
<div class="editor">
<div class="editor-label">
@Resources.Report.MetaAssignedResponsabilities.ResponsibilityCategory
</div>
<div class="editor-field">
<select id="ResponsibilityCategoryId" name="ResponsibilityCategoryId" msr-default=@Resources.Report.MetaAssignedResponsabilities.All msr-read="JsonList/ResponsibilityCategory" class="msr-select" msr-default="@Resources.Report.MetaAssignedResponsabilities.All" msr-value="ResponsibilityCategoryId" msr-text="ShortDescription" style="width:300px" onchange="FilterResponsabilitiesByCategoryResponsabilities()"></select>
</div>
</div>
<div class="editor">
<div class="editor-label">
@Resources.Report.MetaAssignedResponsabilities.ResponsibilityCategory
</div>
<div class="editor-field">
<select id="ResponsibilityCategoryId" name="ResponsibilityCategoryId" msr- default=@Resources.Report.MetaAssignedResponsabilities.All msr- read="JsonList/ResponsibilityCategory" class="msr-select" msr- default="@Resources.Report.MetaAssignedResponsabilities.All" msr- value="ResponsibilityCategoryId" msr-text="ShortDescription" style="width:300px" onchange="FilterResponsabilitiesByCategoryResponsabilities()"></select>
</div>
</div>
<div class="editor">
<div class="editor-label">@Resources.Report.MetaAssignedResponsabilities.Responsibility</div>
<div class="editor-field">
<select id="ResponsibilityId" name="ResponsibilityId" class="msr-select" msr-default=@Resources.Report.MetaAssignedResponsabilities.All style="width: 700px">
@{
var list = db.Responsibility.ToList().Select(o => new { o.ResponsibilityId, o.LongDescription }).OrderBy(w => w.LongDescription);
if (resp == "nothing")
{
foreach (var p in list)
{
<option>@p.LongDescription</option>
}
}
else
{
string[] split = resp.Split(new Char[] { ',' });
foreach (string s in split)
{
var list2 = list.Where(w => w.ResponsibilityId == Convert.ToInt32(s));
foreach (var p in list2)
{
<option>@p.LongDescription</option>
}
}
}
}
}
</select>
JAVASCRIPT:
function FilterResponsabilitiesByCategoryResponsabilities() {
debugger;
var s = $("#ResponsibilityCategoryId").data("kendoDropDownList").value();
s = s == "" ? 0 : s;
switch (s) {
case "1":
s = "1,2,3,4,5,6";
break;
case "2":
s = "7,8,9,10,11,12,13,14";
break;
case "3":
s = "15,16,17,18,19,20,21";
break;
case "4":
s = "22,23,24,25,66";
break;
case "5":
s = "28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,59,60,67,68,69,70,71,72,73,74,75,76,77,78,79,80";
break;
default: s = "0";
}