我在同一个网页上有两个下拉列表:
看法:
@Html.DropDownList("businessType", (SelectList) ViewBag.list, " -- Select Business Type -- ") and
@Html.DropDownList("state", (SelectList) ViewBag.list, " -- Select State -- ")
和控制器:
var query2 = db.Database.SqlQuery<statedropDownModel>("stateDropDownSP");
ViewBag.list = new SelectList(query2.AsEnumerable(), "Code", "StateName", "--select2--");
var query = db.Database.SqlQuery<businessDropDownModel>("businesDropDownSP");
ViewBag.list = new SelectList(query.AsEnumerable(), "ID", "BusinessTypeName", "--select--");
现在的问题是,这两个下拉列表是用不同的数据动态填充的,但是,它发生了冲突,并且两个列表中都填充了相同的数据。有什么解决办法吗?