1.
在后台定义个 protected 的变量 i=0;
2.
前台aspx
<asp:Repeater ID="repNewsHot" runat="server">
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="margin_bb">
<tr>
<td class="biaoti">
热门话题
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class='<%=(i++)<3 ? "CSSStyle1" : "CSSStyle2" %>' height="20px">
<a title='<%# DataBinder.Eval(Container.DataItem,"NewsTitle") %>' href='/News/ShowNewsDetails-<%# DataBinder.Eval(Container.DataItem, "NewsClassID")%>-<%# DataBinder.Eval(Container.DataItem, "NewsClassXID")%>-<%# UrlEncode(DataBinder.Eval(Container.DataItem, "newsID").ToString())%>.html'>
<img src='/images/LeftTop10/left<%=i %>.gif' align="absmiddle" />
<%# Left(DataBinder.Eval(Container.DataItem, "NewsTitle").ToString(),15) %>
</a>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
3.
图片起名字 left1.gif.......left10.gif
that's all, it is very easy!
一个人的孤独,一个人的封闭,不如一起努力!