<asp:Repeater ID="rptXiaoLei" runat="server" OnItemDataBound="rptXiaoLei_ItemDataBound">
<ItemTemplate>
<a href='<%#Eval("columnbh") %><%#Eval("areaId") %><%#Eval("wptype") %>'></a>
<%--传参用--%>
<div class="beauty_f">
<div class="top">
<div class="name">
<a href='listShop.aspx?columnbh=<%#Eval("columnbh") %>&areaId=<%#Eval("areaId") %>&wptype=<%#Eval("wptype") %>'>
<%#Eval("cname") %></a>
</div>
<div id='<%#Eval("columnbh") %>' style="float: left;">
</div>
<div class="more">
<a href='listShop.aspx?columnbh=<%#Eval("columnbh") %>&areaId=<%#Eval("areaId") %>&wptype=<%#Eval("wptype") %>'>
more</a>
</div>
</div>
<div class="content" style="height: auto;">
<div class="content_a" style="height: auto;">
<ul style="width: 930px; height: auto;">
<asp:Repeater ID="rptShangPin" runat="server">
<ItemTemplate>
<li style="width: 180px; float: left;">[<%# GetFirstAreaName(Convert.ToString(Eval("area1Id"))) %>]<a href='detail.aspx?id=<%#Eval("id") %>'
title='<%#Eval("title") %>'><%# CutString(Convert.ToString(Eval("title")),18)%></a>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
cs页代码:
protected void rptXiaoLei_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater rptShangPin = e.Item.FindControl("rptShangPin") as Repeater;//找到里层的repeater对象
DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项
string columnbh = rowv["columnbh"].ToString();//获取填充子类的id
string areaId = rowv["areaId"].ToString();
string wptype = rowv["wptype"].ToString();
//每个栏目下显示多少条商品,在这里手动修改
shopTab = shopAda.GetDataByNumHangyeAreaId("55", columnbh, areaId, wptype);
rptShangPin.DataSource = shopTab;
rptShangPin.DataBind();
}
}