title: Partial View with different ViewModel than Parent's ViewModel
body: <p>In my <code>View</code> I'm displaying a dropdown for selecting a list of years. But the data corresponding to selected year comes from more than one tables. And hence a <code>Partial View</code>'s data corresponding to selected year needs a <code>ViewModal</code>. The data in partial view is a list of records from the ViewModel. <strong>Question</strong>: How can above be achieved while we are dealing with two different ViewModels in a same View. Example follows:</p>
  
  <p><strong>Note</strong>: </p>
  
  <ol>
  <li>I'm using Ajax and <a href="https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro" rel="nofollow noreferrer">Tag Helpers</a>. But any suggestions without these technologies would be fine.</li>
  <li>I'm aware of how to load Partial View data via Ajax.</li>
  </ol>
  
  <p><strong>Parent's ViewModel</strong> [for Years dropdown]</p>
  
  <pre><code>public class OrderYearsViewModel
  {
    public SelectList lstOrderYears { get; set; }    
    public int SelectedOrdYear { get; set; }
  }
  </code></pre>
  
  <p><strong>Parent View</strong></p>
  
  <pre><code>@model MyProj.Models.OrderYearsViewModel
  
  &lt;div&gt;
    &lt;form asp-controller="OrderYearsCtrl" asp-action="SelectYearsList" method="get"&gt;
      Select Order Year:&lt;select asp-for="SelectedOrdYear" asp-items="Model.lstOrderYears"&gt;&lt;/select&gt;&lt;button type="button" value="Go" class="clsGo"&gt;GO&lt;/button&gt;
    &lt;/form&gt;
  &lt;/div
  &lt;div id="OrderDetailsID"&gt;
    &lt;!--Partial view data for selected year displayed here--&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Partial View's ViewModel</strong> [for Orders selected per year]</p>
  
  <pre><code>public class OrdersPerYearViewModel
  {
    public in CustomerID { get; set; }    
    public string CustName{ get; set; }
    public string OrderType { get; set; }
    public float Price { get; set; }
    ....
  }
  </code></pre>
  
  <p><strong>Partial View</strong></p>
  
  <pre><code>@model List&lt;MyProj.Models.OrdersPerYearViewModel&gt;
  &lt;table&gt;&lt;tr&gt;&lt;th&gt;..&lt;/th&gt;..........&lt;/th&gt;&lt;/tr&gt;
  @foreach (var item in Model)
  {
      &lt;tr&gt;
          &lt;td&gt;
              @item.CustomerID
          &lt;/td&gt;
          &lt;td&gt;
              @item.CustName
          &lt;/td&gt;
          &lt;td&gt;
             @item.OrderType
          &lt;/td&gt;
          &lt;td&gt;
             @item.Price 
          &lt;/td&gt;
          ....
  }
  &lt;/table&gt;
  </code></pre>