111,129
社区成员
发帖
与我相关
我的任务
分享
<asp:Panel ID="Panel1" runat="server" ScrollBars="Vertical" width="715px" height="670px" BorderStyle="none">
<asp:Repeater ID="RPFirstType1" runat="server" OnItemDataBound="RPFirstType1_ItemDataBound">
<ItemTemplate>
<div id="Row1" style="width:345px; height:150px; border-bottom:1px dashed #A09F9F; float:left">
<div class="bgyp2_pb_le_tu" style="width:107px; height:102px; margin-left:5px; margin-top:5px; float:left; display:inline;"><img src='<%#Eval("CPicture") %>' style="width:100px; height:100px;padding-bottom:3px; padding-left:3px; padding-right:3px; padding-top:3px;border:solid 1px #CCC;"/></div>
<div class="bgyp2_pb_le_zi" style="width:197px; height:122px; margin-left:15px; margin-top:5px; text-align:left; float:left; line-height:20px;"><a href='leibiexiangxi.aspx?CSid=<%#Eval("CSID") %>&CSname=<%#Eval("CSname") %>' class="hui"><font class="style2lan14"><%#Eval("CSname") %></font></a><br/>
<asp:Repeater ID="RPSecondType1" runat="server">
<ItemTemplate>
<font class="style2hui12"><a href="leibiexiangxichanpin.aspx?CSid=<%#Eval("CSID") %>" class="hui"> <%#Eval("CSname") %></a> | </font>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</asp:Panel>
/// <summary>
/// 当repeater数据绑定事件激发时给二级repeater绑定数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RPFirstType1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater rp = e.Item.FindControl("RPSecondType1") as Repeater;
DataRowView drv = (DataRowView)e.Item.DataItem;
string csname = drv["CSname"].ToString();
rp.DataSource = cb.GetType1(csname);
try
{
rp.DataBind();
}
catch (Exception nn)
{
Console.WriteLine(nn.Message);
}
}
}