TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mark Tabor
586
2k
464.4k
applying _Layout view to in mvc
Apr 27 2019 5:13 AM
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<SelectListItem>' 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
Reply
Answers (
5
)
How to Retrieve files from Google drive link to website
Please how do I fix button click event using bootstrap theme