action代码:
BusinessPublicContent pc = db.BusinessPublicContent.Where(m => m.BusinessPublicContentID == id).FirstOrDefault();
ViewBag.data = pc; var query = from m in db.BusinessMenu
where m.Status == && m.IsDelete == && m.ParentBusinessMenuID == select new
{
BusinessMenuID = m.BusinessMenuID,
BusinessMenuName = m.BusinessMenuName
}; List<SelectListItem> items = new SelectList(query.ToList(), "BusinessMenuID", "BusinessMenuName",id).ToList(); ViewBag.items = items;
html代码:
@Html.DropDownList("mid", ViewBag.items as IEnumerable<SelectListItem>)