title: How can I have a Dynamic nested _Layout with razor?
body: <p>Is it possible to have dynamic nested _layout pages ?</p>
  
  <p>Here's what I got:</p>
  
  <p>_ShopDetailsLayout.cshtml (Dynamic nested _layout):</p>
  
  <pre><code>@model MVC.Web.Areas.Shop.Models.ShopDetailViewModel
  
  @{ 
      Layout = "~/Views/Shared/_Layout.cshtml"; 
  }
  </code></pre>
  
  <p>Credits.cshtml:</p>
  
  <pre><code>@model MVC.Web.Areas.Shop.Models.CreditsViewModel
  
  @{
      ViewBag.Title = "Credits";
      Layout = "~/Areas/Game/Views/Shared/_ShopDetailsLayout.cshtml";
  }
  </code></pre>
  
  <p>the problem i am having is that the other pages, like Credits.cshtml is using the nested layout does not have the same @model so I get this error:</p>
  
  <blockquote>
    <p>The model item passed into the
    dictionary is of type
    'MVC.Web.Areas.Shop.Models.CreditsViewModel',
    but this dictionary requires a model
    item of type
    'MVC.Web.Areas.Shop.Models.ShopDetailViewModel'.</p>
  </blockquote>
  
  <p>I hope anyone can help</p>