Mark Tabor

Mark Tabor

  • 587
  • 2k
  • 460.7k

How to pass multiple models to _Layout.cshtml

Sep 8 2016 11:55 PM
I am a newbie MVC developer , I made a simple website in which i have _Layout.cshtml in the layout i have different partial views like for header , for footer they are static and my work goes well, now the situation arises where i have a Menu link Like services and these services are coming from database  so i made a simple database table I am new to mvc i do not know how to get data from database into the partial view , 
secondly i did the above task via internet help but now when i am calling this partial view then it is already having one model referenced so i cannot reference another model like @model Myapplication.Models.Service
How i can render a partial view in _layout.cshtml without giving the model reference in the _layout.cshtml or how to give multiple models in _layout.cshtml.
 
 Thanks for reply  

Answers (1)