I have a "td" which contains 9 pictures and i want to split them 3 by 3. So i want to get a view like this:
- Pic1 Pic2 Pic3
- Pic4 Pic5 Pic6
- Pic7 Pic8 Pic9
Here is my View code.
@for (int k = 0; k < Model.Count; k++)
{
<td>
<img src="(Model[k].Pic)" width="80" height="90" />
</td>
}
I am trying to split pics by this code:
@for (int k = 0; k < Model.Count; k++)
{
<td>
<div>
<img src="(Model[k].Pic)" width="80" height="90" />
</div>
@if (k % 3 == 0)
{
@:<div></div>
}
</td>
}
But i can't split pictures. It's an easy code but i failed. Where the problem is?