• Repeater嵌套Repeater


            <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=" 930px; height: auto;">
                                    <asp:Repeater ID="rptShangPin" runat="server">
                                        <ItemTemplate>
                                            <li style=" 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();
            }
        }

  • 相关阅读:
    poj- 2528 Mayor's posters
    POJ 2631 Roads in the North (树的直径裸题)
    Quoit Design (白话--分治--平面点对问题)
    洛古 P1020 导弹拦截 (贪心+二分)
    D
    代理模式---动态代理之Cglib
    代理模式---动态代理之JDK
    开闭原则
    迪米特法则
    接口隔离原则
  • 原文地址:https://www.cnblogs.com/yubufan/p/3465125.html
Copyright © 2020-2023  润新知