2 つの dropDownLists があります。
@Html.DropDownListFor(model => model.Organization, (SelectList)ViewBag.Organizations)
@Html.DropDownListFor(model=>model.Doctor, (SelectList)ViewBag.Doctors)
selectList はコントローラから渡されます
List<IOkpolu> orgs = _unitOfWork.Organizations.ToList();
ViewBag.Organizations = new SelectList(orgs, "Code", "Name");
List<IDoctor> docs = _unitOfWork.Doctors.GetAll().ToList();
ViewBag.Doctors = new SelectList(docs, "Code", "Name");
実行時に最初の DropDownList で選択された組織のコードに基づく値を使用して、2 番目の DropDownList (Doctors) をロードします。医師の場合、組織から医師を取得する方法があります。
_unitOfWork.Doctors.GetByOrganization(string organizationCode)
実行時に最初の DropDownList で選択された値を取得し、それを 2 番目の DropDownList に渡すにはどうすればよいですか?
よろしくお願いします!