Hi I have a _layout View which is basically having a model call as shown below
@model Pakeeza_Estate.Models.Country
Now i have created a new Index view and i want to use this above layout as my layout , my index view itself is having an model class as
@model Pakeeza_Estate.Models.Property
now when i set the layout property to
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
and i run the project it gives error
There is no ViewData item of type 'IEnumerable' that has the key 'CountryId'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in
i knew it is asking to give the model of country as well , but i already have another model with this view so how i can add two models to the same view , other then Viewmodel apporoach can i pass the model in controller method instead of binding it using view

Amit KumarRank #459 · 5.4K reputationPosted Apr 27, 2019, 1:18 AM EDT
Mark TaborRank #914 · 2.3K reputationPosted Apr 27, 2019, 1:33 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 27, 2019, 4:51 AM EDT
Mark TaborRank #914 · 2.3K reputationPosted Apr 27, 2019, 6:12 AM EDT
Jignesh Kumar thanks for your reply i have created a view model as showne below
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 27, 2019, 9:21 AM EDT