我有两个下拉列表:
@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 中选择的组织代码加载第二个 DropDownList(Doctors)。对于医生,我有从组织中获取医生的方法:
_unitOfWork.Doctors.GetByOrganization(string organizationCode)
如何在运行时获取第一个 DropDownList 中选择的值并将其传递给第二个 DropDownList?
提前非常感谢!