本帖最后由 su06171209 于 2012-11-15 14:29:48 编辑

解决方案 »

  1.   

    你的接受模型应该是个实体,而不应该是列表集合示例如下
    DropDownListFor常用的是两个参数的重载,第一参数是生成的select的名称,第二个参数是数据,用于将绑定数据源至DropDownListFor
    Modle:
       public class SettingsViewModel
       {
           Repository rp =new Repository();
           public string ListName { get; set; }  
           public  IEnumerable<SelectListItem> GetSelectList()
           {
                   var selectList = rp.GetArea().Select(a => new SelectListItem { 
                                   Text=a.AreaName,
                                   Value=a.AreaId.ToString()
                                   });
                   return selectList;
               }
           } 
    Controller:
           public ActionResult Index()
           {
               return View(new SettingsViewModel());
           }
    View:
    @model Mvc3Applicationtest2.Models.SettingsViewModel
    @Html.DropDownListFor(m=>m.ListName,Model.GetSelectList(),"请选择")