I heard that having @foreach inside of a view is a no-no. Meaning, the view should not have any logic in it. What is the best practice on where the logic for the @foreach sh
I'm using @foreach
when I send an entity that contains a list of entities ( for example to display 2 grids in 1 view )
For example if I'm sending as model the entity Foo that contains Foo1(List
and Foo2(List
I can refer to the first List with:
@foreach (var item in Model.Foo.Foo1)
{
@Html.DisplayFor(modelItem=> item.fooName)
}