You do not need the Razor @ character:
@foreach(CustomObject obj in Model) { @Html.Partial("_TrackingCustomObject",obj) }
Also make sure your partial view uses the CustomObject object type as the model.
@model MyProject.Models.CustomObject <h1>Yeah we're in a partial! @Model.SomeProperty </h1>
To try to expand to the place of the error, try putting some static text inside a PartialView.
<p>Some text</p>
If your collection contains 10 items, you should see 10 of these paragraphs. Then, once this is done, focus on displaying some property in each element.
@model MyProject.Models.CustomObject <p>Some text</p> <p>@Model.SomeProperty</p>
source share