首页 > 代码库 > asp.net中Repeater中用ul li绑定数据

asp.net中Repeater中用ul li绑定数据

<ul class="tit1">
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<li>
<p class="tit1-p-1">
<img style="border: 0px;" src="http://www.mamicode.com/image/biaozhi.jpg" />
<a href="http://www.mamicode.com/newContext.aspx?id=<%#Eval("id") %>">
<%#this.cutString(Eval("title").ToString(),23) %></a></p>

</li>
</ItemTemplate>
</asp:Repeater>
</ul>

Repeater1.DataSource = bll.GetList(6, "Mid=56 and recommandHome=‘是‘", "id desc");
Repeater1.DataBind(); 在后台给数据源绑定下就可以了

itemtemplate标签就是要循环的数据