<table width="98%" cellpadding="3" cellspacing="10" align="center">
<asp:Repeater id="repProduct" runat="server">
<ItemTemplate>
<tr>
<td class="imagetd">
<div><a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>
<img width="80" height="80" src='<%# Eval("product_Image")%>' alt='<%# Eval("product_Name")%>' border="0" /></a></div>
</td>
<td align="left" class="productContent">
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>' style="text-decoration:none; color: #000000;"><%# Eval("product_Name")%></a><br /><br />
<div class="ProductDescription"><%# Leftx(Eval("product_Description").ToString())%></div><br />
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>More</a>
</td>
<td class="imagetd">
<div><a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>
<img width="80" height="80" src='<%# Eval("product_Image")%>' alt='<%# Eval("product_Name")%>' border="0" /></a></div>
</td>
<td align="left" class="productContent">
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>' style="text-decoration:none; color: #000000;"><%# Eval("product_Name")%></a><br /><br />
<div class="ProductDescription"><%# Leftx(Eval("product_Description").ToString())%></div><br />
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>More</a>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
这是我的设计代码,运行效果如下图所示:
请问该如何解决呢?。。
<div>
<asp:Repeater ID="repProduct" runat="server">
<ItemTemplate>
<div style="float:left;">
<table width="50%" cellpadding="3" cellspacing="10" align="center">
<tr>
<td class="imagetd">
<div>
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>
<img width="80" height="80" src='<%# Eval("product_Image")%>' alt='<%# Eval("product_Name")%>'
border="0" /></a></div>
</td>
<td align="left" class="productContent">
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>' style="text-decoration: none;
color: #000000;">
<%# Eval("product_Name")%>
</a>
<br />
<br />
<div class="ProductDescription">
<%# Leftx(Eval("product_Description").ToString())%>
</div>
<br />
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>More</a>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<table width="98%" cellpadding="3" cellspacing="10" align="center">
<asp:Repeater id="repProduct" runat="server">
<ItemTemplate>
<tr>
<td class="imagetd">
<div><a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>
<img width="80" height="80" src='<%# Eval("product_Image")%>' alt='<%# Eval("product_Name")%>' border="0" /></a></div>
</td>
<td align="left" class="productContent">
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>' style="text-decoration:none; color: #000000;"><%# Eval("product_Name")%></a><br /><br />
<div class="ProductDescription"><%# Leftx(Eval("product_Description").ToString())%></div><br />
<a href='productDetail.aspx?ID=<%# Eval("product_ID")%>'>More</a>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<%#((RepeaterItem)Container).ItemIndex%2==0 ? "<tr>" : "" %>
<td>
......
</td>
<%#(((RepeaterItem)Container).ItemIndex%2 - 1 )==0 ? "</tr>" : "" %>
</ItemTemplate>
比如总宽是100px,要求显示两列,就把每列宽设为50px,排版靠左就OK