假设存在“大商品”、“小商品”和“货物”两张表,小商品的BID是大商品的外键;货物的GID又是小商品的外键。
那么:
<asp:Repeater id="repBigGoods" DataKeys="xxx"....>
<ItemTemplate>
<%#Eval("BigCategoryName")%>
<asp:Repeater id="repSmallgoods" ... DataSourceId="dsSmallGoods" DataKeys="xxx">
<ItemTemplate> <%#Eval("SmallCategoryName")%>
<asp:Repeater id="repGoods" ...>
<ItemTemplate> <%#Eval("GoodsName")%> </ItemTemplate> </asp:Repeater>
<asp:SqlDataSource id="dsGoods" .... SelectCommand="select GoodsName from goods where gid=@gid"....> <SelectParameter> <asp:Parameter Name="gid" Type="Int32"..../> </SelectParameter> </ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource id="dsSmallGoods" .... SelectCommand="select SmallCategoryName from smalllcategory where bid=@bid"....> <SelectParameter> <asp:Parameter Name="bid" Type="Int32"..../> </SelectParameter>
<ItemTemplate>
</asp:Repeater>
然后:
private void repBigGoods_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { RepeaterItem item = e.Item; if( (item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem) ) { Repeater repsmallgoods = (Repeater) item.FindControl("repSmallgoods"); SqlDataSource dsSmallGoods = (SqlDataSource)repsmallgoods.FindControl("dsSmallGoods")as SqlDataSource; dsSmallGoods.SelectParameters["bid"].DefaultValue = (e.Item As DataRowView).Row["Primary Column Name"].ToString(); } }
private void repSmallgoods_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { RepeaterItem item = e.Item; if( (item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem) ) { Repeater repGoods = (Repeater) repsmallgoods.FindControl("repGoods"); SqlDataSource dsGoods = (SqlDataSource)repsmallgoods.FindControl("dsgoods")as SqlDataSource; dsGoods.SelectParameters["gid"].DefaultValue = (e.Item As DataRowView).Row["Primary Column Name"].ToString(); } }
具体可以参考这里(双层嵌套):
/KB//AspNetNestedRepeaters.aspx
RAKsmart 商家估摸着前段时间服务器囤货较多,这两个月的促销活动好像有点针对独立服务器。前面才整理到七月份的服务器活动在有一些配置上比上个月折扣力度是大很多,而且今天看到再来部分的服务器首月半价,一般这样的促销有可能是商家库存充裕。比如近期有一些服务商挖矿服务器销售不好,也都会采用这些策略,就好比电脑硬件最近也有下降。不管如何,我们选择服务器或者VPS主机要本着符合自己需求,如果业务不需要,...
昔日数据怎么样?昔日数据是一个来自国内服务器销售商,成立于2020年底,主要销售国内海外云服务器,目前有国内湖北十堰云服务器和香港hkbn云服务器 采用KVM虚拟化技术构架,湖北十堰机房10M带宽月付19元起;香港HKBN,月付12元起; 此次夏日活动全部首月5折促销,有需要的可以关注一下。点击进入:昔日数据官方网站地址昔日数据优惠码:优惠码: XR2021 全场通用(活动持续半个月 2021/7...
BuyVM测评,BuyVM怎么样?BuyVM好不好?BuyVM,2010年成立的国外老牌稳定商家,Frantech Solutions旗下,主要提供基于KVM的VPS服务器,数据中心有拉斯维加斯、纽约、卢森堡,付费可选强大的DDOS防护(月付3美金),特色是1Gbps不限流量,稳定商家,而且卢森堡不限版权。1G或以上内存可以安装Windows 2012 64bit,无需任何费用,所有型号包括免费的...