title: How use asp.net mvc partial view in layout within @RenderPage
body: <p>I have Partial view <strong>LeftBanner.cshtml</strong> that should display some data from DB (images)</p>
  
  <p><strong>LeftBanner.cshtml</strong></p>
  
  <pre><code>@model IEnumerable&lt;WebApplication1.ViewModels.Banner&gt;
  
      &lt;table class="table"&gt;
  
  
     &lt;tr&gt;
          &lt;th&gt;Test Banner!&lt;/th&gt;
      &lt;/tr&gt;
  
      @foreach (var banner in Model)
      {
          &lt;tr&gt;
              &lt;td&gt;
                  @Html.LabelFor(b =&gt; banner.ImageDesc);
                  &lt;img src="@Url.Content(banner.ImagePath)" alt="Image" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      }
  
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>SharedController</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  using WebApplication1.ViewModels;
  
  namespace WebApplication1.Controllers
  {
      public class SharedController : Controller
      {   
          public ActionResult LeftBanner()
          {
              List&lt;Banner&gt; b = new List&lt;Banner&gt;() {
                  new Banner() {ImageDesc = "Left Banner Description", ImagePath = "~/Images/money.jpg" },
                  new Banner() {ImageDesc = "Left Banner Description2", ImagePath = "~/Images/money.jpg" }
              };
               return View(b);
             // return View();
          }
      }
  }
  </code></pre>
  
  <p><strong>_Layout.cshtml</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
          @RenderPage("~/Views/Shared/LeftBanner.cshtml") 
      &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>The Error</strong></p>
  
  <pre><code>The model item passed into the dictionary is of type 'WebApplication1.ViewModels.EmployeeListViewModel', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[WebApplication1.ViewModels.Banner]'.
  </code></pre>
  
  <p>In Asp.net Web-forms ascx UserControls can be independent and really reusable.</p>
  
  <p>Please help my to understand, why i can't encapsulate my partial view?
  It is not real reuse,
  If I have to pass to partial view  model every time I use it.
  Can it be independent and go to a database without passing it a model?</p>
  
  <p>Thanks a lot!</p>