VisualStudio2010 tells me that it's the Model Property associated with System.Mvc.ViewDataDictionary Object
which is helpful, but the docs for DataDictionary don't seem to show me what I want, in an easily understood format, at least.
Note that the following .cshtml
file is in BorkedModel
's View folder, but the model I want to access is in ExampleModel
's Model folder. This exact code would work if the file itself was in the ExampleModel
's View folder, but not in a different model's View folder.
ProjectTopDirectory/Views/BorkedModel/index.cshtml
@model IEnumerable<ExampleMVC4.Models.ExampleModel> @foreach (var item in Model) { <HTML here/> }
Is there a solution to what I'm doing, or should I just keep models in their own view, and that's it? Is there a way to access one Model from another Model's View?