本文介绍了如何选择下拉MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有数据收集 i想要根据以前的选择选择ddl @for(int i = 0; i < Model.listAddressEnity.Count; i ++) { @ Html.DropDownListFor(x = > x.listAddressEnity [i] .City_ID,(SelectList)ViewBag.City_ID)} var selectList = new SelectList(objCityHandler.SP_GET_CITY()。选择(s = > new {Id = s.City_ID,Name = s.City_Name}), Id, 名称 ); ViewBag.City_ID = selectList; 我的问题是列表中的数据 否单个数据中的问题 var selectList = new SelectList(objCategoryHandler.SP_GET_CATEGORY()。选择(s = > new {Id = s。 Categoty_ID,Name = s.Category_Name}), Id, 名称,objProductCollectionEntity.ProductEntity.Categoty_ID); 但如何选择List 解决方案 将列表数据绑定到下拉列表 @ Html .DropDownList( Country, ViewBag.City_ID as SelectList , 选择城市,new {style = width:200px}) 看到这个.. :) 如何在MVC中获取Controller中的下拉值 [ ^ ] i have collection of datai want to select ddl on basis of previous selection @for (int i = 0; i < Model.listAddressEnity.Count; i++) { @Html.DropDownListFor(x => x.listAddressEnity[i].City_ID, (SelectList)ViewBag.City_ID)}var selectList = new SelectList(objCityHandler.SP_GET_CITY().Select(s => new { Id = s.City_ID, Name = s.City_Name }), "Id", "Name"); ViewBag.City_ID = selectList;My problem is data in ListNo problem in single datavar selectList = new SelectList(objCategoryHandler.SP_GET_CATEGORY().Select(s => new { Id = s.Categoty_ID, Name = s.Category_Name }), "Id", "Name", objProductCollectionEntity.ProductEntity.Categoty_ID);but how to do selection with List 解决方案 Bind List data to [email protected]("Country", ViewBag.City_ID as SelectList, "Select City", new { style = "width:200px" })see this.. :)How to get drop down value in Controller in MVC[^] 这篇关于如何选择下拉MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-01 01:48