<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>
这是我的设计代码,运行效果如下图所示:
请问该如何解决呢?。。

解决方案 »

  1.   

    实际上,这应该在BLL工程中就自动测试出所有问题,而不是在无关的表现层去测试。不过业余软件开发,也就不太计较稍微工程一点的做法了。
      

  2.   

    你的Repeater里绑定的写了两遍,当然显示有重复了
      

  3.   


       <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>
      

  4.   


    <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>
      

  5.   

    <ItemTemplate>
            <%#((RepeaterItem)Container).ItemIndex%2==0 ? "<tr>" : "" %>
            <td>
            ......
            </td>
            <%#(((RepeaterItem)Container).ItemIndex%2 - 1 )==0 ? "</tr>" : "" %>
            </ItemTemplate>
      

  6.   

    样式不对 调下就好了 思路是用div居左显示,宽度设好。
    比如总宽是100px,要求显示两列,就把每列宽设为50px,排版靠左就OK
      

  7.   

    谢谢各位的解答。。后面我用DataList,发现省了不少事情,呵呵:)
      

  8.   

    请问怎么用DataList实现的?我也遇到这问题了