MVC를 수행하고 드롭 다운 목록에서 조회 값을 지정합니다. 조회를 업데이트하기 전에 UpdateModel을 호출 할 때는 값만 업데이트하고 아무 것도 호출하지 않습니다. 그래도 오류는 발생하지 않습니다.MVC - UpdateModel 및 DropDownLists
내가 편집하고 만들어 내 cintroller에 다음 코드를 사용할 수 있습니다.
을 ViewData [ "SiteMaintenanceId"] = this._siteRepository.FindAllSiteMaintenances()에서 m에서 ToList()
select new SelectListItem
{
Text = m.Maintenance,
Value = m.SiteMaintenanceId.ToString(),
Selected = (m.SiteMaintenanceId == site.SiteMaintenanceId)
};
return View(new SiteFormViewModel(site,
this._siteRepository.FindAllSiteOperators()));
나는 내보기에 다음과 같은 한 :
이 확인 결합 보인다 나를 아래로 내 드롭의 편집에서 선택한 가치를 얻을하고 작품을 만들 수 있습니다.
이것은 MVC를 처음 시작한 것이므로 도움을 주시면 감사하겠습니다.