假设存在“大商品”、“小商品”和“货物”两张表,小商品的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
Hostodo发布了几款采用NVMe磁盘的促销套餐,从512MB内存起,最低年付14.99美元,基于KVM架构,开设在拉斯维加斯机房。这是一家成立于2014年的国外VPS主机商,主打低价VPS套餐且年付为主,基于OpenVZ和KVM架构,产品性能一般,数据中心目前在拉斯维加斯和迈阿密,支持使用PayPal或者支付宝等付款方式。下面列出几款NVMe硬盘套餐配置信息。CPU:1core内存:512MB...
raksmart作为一家老牌美国机房总是被很多人问到raksmart香港服务器怎么样、raksmart好不好?其实,这也好理解。香港服务器离大陆最近、理论上是不需要备案的服务器里面速度最快的,被过多关注也就在情理之中了。本着为大家趟雷就是本站的光荣这一理念,拿了一台raksmart的香港独立服务器,简单做个测评,分享下实测的数据,仅供参考!官方网站:https://www.raksmart.com...
提速啦(www.tisula.com)是赣州王成璟网络科技有限公司旗下云服务器品牌,目前拥有在籍员工40人左右,社保在籍员工30人+,是正规的国内拥有IDC ICP ISP CDN 云牌照资质商家,2018-2021年连续4年获得CTG机房顶级金牌代理商荣誉 2021年赣州市于都县创业大赛三等奖,2020年于都电子商务示范企业,2021年于都县电子商务融合推广大使。资源优势介绍:Ceranetwo...