MVC4 issue with showing multile partial views on a single View

preeryrah

New Member
I have been struggling with this problem to no avail. Using MVC4 I have 3 models I wish to show on a single view via partial views. The Single View is comprised of 3 partial views (3 numerated list tables). I can get one model to display in the view, but can't figure out how to display the other 2.Here is what I have for The View Controller: \[code\][AllowAnonymous] public ActionResult Dashboard() { //Database.SetInitializer<AlertsContext>(null); Database.SetInitializer<MemberUsersContext>(null); //Database.SetInitializer<ClubsContext>(null); //AlertsContext db = new AlertsContext(); MemberUsersContext db = new MemberUsersContext(); //ClubsContext db = new ClubsContext(); //db.MemberUsers.ToList() return View(db.MemberUsers.ToList()); }\[/code\]This is what I have as the model for the View itself (to compile I remove the two that aren't under the @model IENumerable statement:\[code\] @model IEnumerable<GMC.Models.MemberUsers> <div class="dashboard_alerts"> @Html.Partial("DashboardAlerts") </div> <div class="dashboard_pending_clubs"> @Html.Partial("DashboardClubs") </div> <div class="dashboard_verified_members"> @Html.Partial("DashboardMembers") </div>\[/code\]In each partial View the headers are as follows:DashboardClubs\[code\] @model IEnumerable<GMC.Models.Clubs>\[/code\]DashboardMembers\[code\] @model IEnumerable<GMC.Models.MemberUsers>\[/code\]DashboardAlerts\[code\] @model IEnumerable<GMC.Models.Alerts>\[/code\]Now my question is how do I pass the three database contexts into the Dashboard? I am thoroughly confused and am struggling.
 
Top