假设存在“大商品”、“小商品”和“货物”两张表,小商品的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
欧路云(oulucloud) 商家在前面的文章中也有陆续介绍过几次,这不今天有看到商家新增加美国Cera线路的VPS主机,而且有提供全场八折优惠。按照最低套餐最低配置的折扣,月付VPS主机低至22元,还是比较便宜的。不过我们需要注意的是,欧路云是一家2021年新成立的国人主机商,据说是由深圳和香港的几名大佬创建。如果我们有介意新商家的话,选择的时候谨慎且月付即可,注意数据备份。商家目前主营高防VP...
ShockHosting商家在前面文章中有介绍过几次。ShockHosting商家成立于2013年的美国主机商,目前主要提供虚拟主机、VPS主机、独立服务器和域名注册等综合IDC业务,现有美国洛杉矶、新泽西、芝加哥、达拉斯、荷兰阿姆斯特丹、英国和澳大利亚悉尼七大数据中心。这次有新增日本东京机房。而且同时有推出5折优惠促销,而且即刻使用支付宝下单的话还可获赠10美金的账户信用额度,折扣相比之前的常规...
乐凝网络怎么样?乐凝网络是一家新兴的云服务器商家,目前主要提供香港CN2 GIA、美国CUVIP、美国CERA、日本东京CN2等云服务器及云挂机宝等服务。乐凝网络提供比同行更多的售后服务,让您在使用过程中更加省心,使用零云服务器,可免费享受超过50项运维服务,1分钟内极速响应,平均20分钟内解决运维问题,助您无忧上云。目前,香港HKBN/美国cera云服务器,低至9.88元/月起,支持24小时无理...