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
Jignesh KumarPosted Apr 27, 2019, 1:21 PM
Mark TaborPosted Apr 27, 2019, 10:12 AM
Jignesh Kumar thanks for your reply i have created a view model as showne below
Jignesh KumarPosted Apr 27, 2019, 8:51 AM
Mark TaborPosted Apr 27, 2019, 5:33 AM
Amit KumarPosted Apr 27, 2019, 5:18 AM