Hi i want help in putting contents side by side.
Right now i can display content separately in left side and right side. But i need to display records from database. For this i am using foreach loop. So how i need to display is 1st records on left side and 2nd record on right side and 3rd on left and so on. How can i loop through like this.
I am stucked here.I need help..
I am using this code but all the contents are displaying as i told earlier.
<body>
@foreach (var item in Model)
{
<!-- Main Table(You can define padding accordingly) -->
<table width="80%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="50%">
<!-- Table on left side -->
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td>
<span class="Title">APP</span>
<br/>
<div class="listRowA" onmouseover="this.className='listRowAHover'" onmouseout="this.className='listRowA'">
<div class="listPageCol" onclick="location.href='../Home/ControlPanel'">
<span class="listlCol1">
<br />
@item.ID
</span>
<span class="listCol2"><img src="../Content/Images/20_thumb.jpg" width="281" height="200" border="0" alt="image" /></span>
</div>
</div>
</td>
</tr>
<tr>
<td> </td>
<td></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<!-- END -->
</td>
<td width="50%">
<!-- Table on right side -->
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td>
<div class="listRowA" onmouseover="this.className='listRowAHover'" onmouseout="this.className='listRowA'">
<span class="listCol2"><img src="../Content/Images/20_thumb.jpg" width="281" height="200" border="0" alt="image" /></span></div>
</td>
</tr>
<tr>
<td> </td>
<td></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<!-- END -->
</td>
</table>
<!-- END OF MAIN TABLE -->
}
</body>
Instead of
use
and access properties of model like
In order to determine which should go to right which should go left you can use
and
Just make sure that
i+1
is never more thanModel.Count