日期:2014-05-18  浏览次数:20437 次

跪求专家,DataList嵌套Repeater,包含的个数不等,不想要每行等高,去掉空白

目前效果,不想数目不同时,行行中间留下空白

想要的效果,紧凑一些

代码如下:

 
C# code

     <asp:DataList id="BigCategories" runat="server" RepeatColumns="5" ItemStyle-VerticalAlign="Top"  RepeatLayout="Table" RepeatDirection="Vertical"
                OnItemDataBound="BigCategories_ItemDataBound"> 
  <ItemTemplate> 
    <!--分类名称-->
        <a class="newstitle" href='CatalogInfoList.aspx?catalogtop=<%# HttpUtility.UrlEncode(Eval("catalogtop").ToString()) %>' 
             target="_blank"><%# Eval("catalogtop") %></a>
    <!--分类下的产品--> 
    <asp:Repeater ID="MinCategories" runat="server"> 
      <ItemTemplate> 
        <a href='CatalogInfoList.aspx?catalogsub=<%# HttpUtility.UrlEncode(Eval("catalogsub").ToString()) %>' target="_blank"><%# Eval("catalogsub") %></a>
      </ItemTemplate> 
    </asp:Repeater> 
  </ItemTemplate>
 </asp:DataList>
   


------解决方案--------------------
CSS code

#box{width:300px;background:#ccc;}
.main{float:left;background:#fff;*height:30px;}
.title{width:100px;height:15px;font-size:14px;color:#000;font-weight:bold;}
.cont{width:100px;height:12px;font-size:12px;color:#ccc;}