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); } }