ViewBag.QuestionnaireType = new SelectList(questionCollectionTypeList, "CodeID", "CodeName", selectValue).AsEnumerable();
@Html.DropDownList("QuestionnaireType", ViewBag.QuestionnaireTypes as SelectList, new { @class = "select3" })
上面的写法是错误的,标红的地方名称不能相同。
下面的写法是正确的。
ViewBag.QuestionnaireTypes = new SelectList(questionCollectionTypeList, "CodeID", "CodeName", selectValue).AsEnumerable();
@Html.DropDownList("QuestionnaireType", ViewBag.QuestionnaireTypes as SelectList, new { @class = "select3" })
具体原因带查找。