为了账号安全,请及时绑定邮箱和手机立即绑定

跪求大侠帮忙看下这个DropDownList编辑的问题 实在是没豆了 谢谢!

跪求大侠帮忙看下这个DropDownList编辑的问题 实在是没豆了 谢谢!

慕容森 2018-12-06 21:51:29
控制器: int etid =int.Parse(EditID); A_CustomerInfoModel model = new A_CustomerInfoModel(); List<A_CustomerInfoModel> list = base.CustomerInfo.GetModelEdit(EditID) as List<A_CustomerInfoModel>; if (list.Count > 0) { foreach (A_CustomerInfoModel item in list) { List<SelectListItem> items = new List<SelectListItem>(); items.Add(new SelectListItem { Text = "Personal", Value = "0" }); items.Add(new SelectListItem { Text = "Company", Value = "1"}); foreach (SelectListItem item_sp in items) { if (item_sp.Value == item.A_CutomerType) { var selectList = new SelectList(items, items[0].Text, items[0].Value, item.A_CutomerType); ViewData["dorplist_sp"] = selectList; } } model.A_Customer_Name = item.A_Customer_Name; model.Homepage = item.Homepage; model.A_province = item.A_province; model.A_city = item.A_city; model.A_Customer_Address = item.A_Customer_Address; model.A_Customer_Post = item.A_Customer_Post; model.A_Contactperson = item.A_Contactperson; model.A_Contacter_Tel = item.A_Contacter_Tel; model.A_IDcardNo = item.A_IDcardNo; model.A_Contacter_fax = item.A_Contacter_fax; model.A_Contacter_email = item.A_Contacter_email; } return View(model); } else { //没有数据 return View(); } 视图代码: @Html.DropDownList("dorplist_sp", ViewData["dorplist_sp"] as SelectList) 我改成@Html.DropDownList("dorplist_sp")也不行 页面报错提示: DataBinding:“System.Web.Mvc.SelectListItem”不包含名为“Personal”的属性。
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 320 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信