DropDownListFor如何绑定多个字段?

View层代码 :

 @Html.DropDownListFor(model => model.ControllerActioId, (SelectList)ViewData["ControllerAction"])

 

controller层代码:

        public ActionResult Create()
        {
            ViewData["ControllerAction"] = new SelectList((from s in db.ControllerAction
                            select new
                            {
                                ID = s.Id,
                                FullName = s.ControllName + "/" + s.Name
                            }), "Id", "FullName", null);
            return View();
        }

        ControllerAction ca = new ControllerAction();
        public string Fullname
        {

            get
            {
                return string.Format("{0} {1}", ca.ControllName, ca.Name);
            }
        }

 

posted @ 2013-04-10 16:27  Awey  阅读(221)  评论(0编辑  收藏  举报