I understand how to handle a foreach loop over a single data structure using page inheritance in ASP.NET MVC, but I want to display the contents of two different types of data on the same page. How can this be done since pages only accept one class for inheritance?
Share
As the guys before me pointed out, the correct answer if we understood you correctly is composition. The idea is to give the page one model, which contains two other models, eg.
The idea here is that your class now derives from
ViewPage<Car>, which allows you to do this:Sitting behing a <%= Model.Engine.ToString() %> engine, there are:
Hope this answers your question.