Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to use two different in the same view .How to do that ?
There may be the scenario that one model could have two different classes or two models .
Please tell me that how to use that in the same view in both the mentioned scenario.
Posted

1 solution

Using more than one model in one view is not possible.

But there is a workaround:

You can use a so-called ViewModel which combines the models
you want to use.

There is a good article describing it:
Multiple Models in a View in ASP.NET MVC 4 / MVC 5[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900