I have a site using a single master.page. In the master.page I have a strongly typed user control (.ascx) called "ControlPanel". Its type is ControlPanelViewModel.
Here is the mater page - MasterFrame.master:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<body>
<% Html.RenderPartial("ControlPanel"); %> <!-- Here I need to pass the ControlPanelViewModel -->
<!-- main content area -->
</body>
</html>
Here is the custom control page - ControlPanel.ascx:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ControlPanelViewModel>" %>
<!-- Some content which are using the ControlPanelViewModel -->
Now the question is how to send the correct ControlPanelViewModel to master page's custom control? What is the best approach? Is there some sort of good practice or design pattern for this case?