What I have currently is the below which works fine but now it shows my records in a long list, what i want to do is show three(3) records per row. I tried putting a for loo
Use for block and print based on the value of or i. If it's the first index (i equals 0) or it's the fourth, seventh, ... (3n+1)th index (i % 3 equals 0), then print after before . If it's the last index ( i equals Model.Clients.Count - 1) or it's the third, sixth, ... (3n)th index (i % 3 equals 2), then print . The below code should give what you want.
@for (int i = 0; i < Model.Clients.Count; i++)
{
if (i == 0 || i % 3 == 0)
{
}
@Html.Hidden("ClientID", Model.Clients[i].ClientID)
@Html.Label(Model.Clients[i].ClientName)
if (i % 3 == 2 || i == Model.Clients.Count - 1)
{
}
}