Search code examples
c#.netasp.net-mvcrazor

ASP.NET MVC Razor pass model to layout


What I see is a string Layout property. But how can I pass a model to layout explicitly?


Solution

  • Seems like you have modeled your viewmodels a bit wrong if you have this problem.

    Personally I would never type a layout page. But if you want to do that you should have a base viewmodel that your other viewmodels inherits from and type your layout to the base viewmodel and you pages to the specific once.