I am trying to render my views using DisplayForModel and EditorForModel helper function. As the first step, I have the list controller that writtens Ienumarable list of organizations.
I have followed the answers of Darian from this SO question, and did as below.
In - list.cshtml
@using PartyBiz.Models.Objects
@model IEnumerable<Organization>
@Html.DisplayFor( model => model.Organizations )
In - Organization.cshtml
@model PartyBiz.Models.Objects.Organization
<div>@Model.Caption </div>
<div>@Model.Description </div>
<div>@Model.NameInUse </div>
My model has the below property
public IEnumerable<Organization> Organizations { get; set; }
Controller list action
public ViewResult List(OrganizationQuery qry = null)
{
return View(OrganizationRepo.All() as IEnumerable<Organization>);
}
However I am getting the compile error:
Compiler Error Message: CS1061: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Organizations' and no extension method 'Organizations' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
please advise what I am doing wrong here?