时间:2021-07-01 10:21:17 帮助过:23人阅读
后台无论用viewbag或是viewdata都不是重点,前台无论用@Html.DropDownList @Html.DropDownListFor都无所谓
重点是当后台用ViewData["typeBtnList"]=..... 或者ViewBag.typeBtnList =......前台用
@Html.DropDownList("typeBtnList", ViewData["typeBtnList"] as List
@Html.DropDownList("typeBtnList", ViewBag.typeBtnList as List
而当我们把前台改成
@Html.DropDownList("aaaaa", ViewData["typeBtnList"] as List
@Html.DropDownList("aaaaa", ViewBag.typeBtnList as List
结论:
参数命名很重要,因为看不到源码,故猜测问题便是名称问题