在代码中定义一个

protected int i;

然后在ASPX中的Repeater的ItemTemplate,如下代码:

                    <ItemTemplate>
                      
<%  if (i == 0)
                         {
%>
                        
<tr>
                            
<% } %>
                            
<td>
                                 
<%#  Container.ItemIndex+ 1 %>
                            
</td>
                       
<%if (i == 1)
                              {
%>
                            
</tr>
                       
<%} i = (i + 1) % 2%>
                    
</ItemTemplate>

目标效果:
1  2 
3  4 
5  6 
7  8 
9  10 

posted on 2007-09-14 11:22  PetterLiu  阅读(1037)  评论(1编辑  收藏  举报