I have two dropdown at layout screen which are shared in two views.
1. Scheduler view 2. worklistview
I have to populate both dropdown on Page load also on selection of first dropdown other dropdown value should populate.
Scheduleview screen and worklist screen should change based on dropdown vaue.
I have created scheduleviewmodel which is binding to these two dropdowns at layout page.
ScheduleviewModel is binding to scheduler screen but worklistviewModel binding to worklist screen.
So when I am moving to worklist screen dropdown at layout throwing exception.As this view using worklistViewModel.
Please help me how can I move this to common model.
worklistview searching for scheduleviewmodel as layout using it but worklistview using worklistViewModel.
How to use separate model for layout which can be used by both views.
Thank You.
What I have tried:
I have javascript written to populate dependent dropdown and load Schedule screen.
Layout page :
@model ORSA.ViewModel.ScheduleViewModel
@Html.DropDownListFor(m => m.CurrentFacilityId, new SelectList(Model.FacilityList, "FacilityId", "FacilityName"), new {@class = "dropdown1"})
@Html.DropDownListFor(m => m.CurrentLocationId, new SelectList(Model.LocationList, "LocationId", "LocationName"), "All Locations", new { @class = "dropdown1" })
ScheduleController :
public ActionResult Schedule()
{
private ScheduleViewModel model = new ScheduleViewModel();
model.FacilityList = helpObj.GetFacilityList();
model.LocationList = helpObj.GetLocations(facilityId);
return view(model)
}
@model ORSA.ViewModel.ScheduleViewModel
@model ORSA.ViewModel.WorklistViewModel