Reputation: 10689
Is there syntax to create a condition in the 'foreach' loop used in the view page?
@foreach (var item in Model.Where(item.Status != "C") {
<tr>
<td>
@Html.DisplayFor(modelItem => item.TableName)
</td>
.
.
.
The syntax for this foreach is incorrect, does anyone have an idea what it should be? (The rest of the table is truncated)
Upvotes: 0
Views: 4958
Reputation: 624
You're missing a parenthesis on the end of the foreach line:
@foreach (var item in Model.Where(item.Status != "C")) {
Upvotes: 1
Reputation: 1275
@foreach (var item in Model.Items.Where(i => i.Status != "C") {
<tr>
<td>
@Html.DisplayFor(modelItem => item.TableName)
</td>
Upvotes: 2