控制器:
public ActionResult Details(int id)
{
ViewBag.AccountType = new BusinessLayer.AccountTypeManager().GetAccountTypes();
return View(new BusinessLayer.AccountManager().getAccount(id));
}
看法:
<div class="display-label">Account Type</div>
<div class="display-field">@Html.DisplayFor(modelItem => modelItem.AccountType)</div><br />
此当前视图显示 AccountType ID。如何显示由 ViewBag.AccountType (IEnumerable) 传递的 AccountType 名称