title: pass a different model to the partial view
body: <p>I am trying to pass a different model to the partial view from a view. I have two separate controller actions for both of them and two different view models. But when I call the partial view from within the view it gives me the error</p>
  
  <p>The model item passed into the dictionary is of type 'Application.ViewModels.Model1ViewModel', but this dictionary requires a model item of type 'Application.ViewModels.PartialViewModel'.</p>
  
  <p>I am calling it like this:</p>
  
  <pre><code> @Html.Partial("_CreateUniFunctionPartial")
  </code></pre>
  
  <p>the model call in the view is </p>
  
  <pre><code>@model Application.ViewModels.Model1ViewModel
  </code></pre>
  
  <p>and model in partial view file is </p>
  
  <pre><code>@model Application.ViewModels.PartialViewModel
  </code></pre>
  
  <p>I am not sure how to pass the partial view so it doesnt give this error.</p>
  
  <p>EDIT</p>
  
  <p>Partial view </p>
  
  <pre><code>@model Application.ViewModels.PartialViewModel
  
  
  
   @using (Html.BeginForm("partialview", "ApplicationDetail", FormMethod.Post)) 
    {
  
  
  &lt;div class="form-horizontal"&gt;
      &lt;h4&gt;UniFunctionViewModel&lt;/h4&gt;
      &lt;hr /&gt;
      @Html.ValidationSummary(true)
  
  
  
  
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.detail, new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.TextBoxFor(model =&gt; model.detail, new { @placeholder = "Further Information" })
              @Html.ValidationMessageFor(model =&gt; model.detail)
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  &lt;/div&gt;
  </code></pre>
  
  <p>}</p>