<% cnt = 0; %>
<asp:Repeater ID="rpt_sp_book" runat="server">
<ItemTemplate>
<% cnt++;
if(cnt<3){ %>
<li class="img">
<table width="100%" border="0" class="pro1" cellspacing="0" cellpadding="0">
<tr>
<td><a href="product_detail.aspx?id=<%# Eval("ID") %>" target="_blank"><img src="<%# Inc.GetPic(Eval("picture")) %>" width="90" height="90" /></a></td>
</tr>
<tr>
<td height="28" align="center"><a href="product_detail.aspx?id=<%# Eval("ID") %>" target="_blank"><%# Utils.CutString(Eval("Name").ToString(),14) %></a></td>
</tr>
</table>
</li>
<% if (cnt == 2){ %>
<li class="clear"></li>
<% } %>
<% }else{ %>
<li> <a href="product_detail.aspx?id=<%# Eval("ID") %>" target="_blank"><%# Utils.CutString(Eval("Name").ToString(),34) %></a></li>
<% } %>
</ItemTemplate>
</asp:Repeater>
取10条记录,前两条为图片文字样式,后面为文字列表样式,怎么去定制,这里我用了中很糟糕的方法临时实现了,但是页面里这种类型的样式是很多的,请教多种样式的显示方法,能够应用复杂样式的情况,能完善解决不甚感激!
还不如直接分两个Repeater,取出来的数据前两条绑前一个,后面的数据绑后一个.
样式:
#goods-lie{width:100%;
margin:5px auto;}
.goods1{width:210px;
height:262px;
margin:2px;
position:relative;
float:left;
}
ul .goods1{list-style-type:none;}
.pic{height:210px;
width:210px;
border:#CCCCCC solid 1px;
vertical-align:top;
}
.price{margin:2px auto; vertical-align:top;}
.youhu{margin:2px auto; vertical-align:top;}
.name{margin:2px auto; vertical-align:top;}
源码:
<div id="goods-lie" class="goods-lie">
<asp:Repeater ID="GoodsList1" runat="server">
<ItemTemplate>
<ul class="goods1">
<li id="pic" class="pic"><a
href="GoodsDetail.aspx?id=<%#Eval("GID") %>"><img alt=""
src='User/images/<%#Eval("GImage") %> ' width="210" height="210"
border="0" /></a></li>
<li
class="price">售价:<span
class="STYLE1"><%#string.Format("{0:c}",Eval("GPrice"))
%></span> 元</li>
<li
class="youhu"><img alt="" src="images/pr_right_pic6.gif"
width="40" height="20" /> <img alt=""
src="images/pr_right_pic7.gif" /></li>
<li
class="name"><a href="GoodsDetail.aspx?id=<%#Eval("GID")
%>"><%#Eval("GName") %></a></li>
</ul>
</ItemTemplate>
</asp:Repeater>
</div>http://www.chinadrtv.com/shouji/3Gshouji/4451.shtml