<asp:repeater id= "RPT1" runat= "Server" onitemdatabound= "Rpt1_itemdatabound" > <HeaderTemplate> <table width=400 cellpadding=0 cellspacing=0>
backstage. Aspx.cs
protected void Rpt1_itemdatabound (object sender, RepeaterItemEventArgs e) { if (E.item.itemtype = = ListItemType.Item | | e.item.itemtype = = ListItemType.AlternatingItem) { Repeater rpt2 = (Repeater) e.item.findcontrol ("Rpt2"); //Find the data items associated with the taxonomy repeater DataRowView ROWV = (DataRowView) e.Item.DataItem; Rpt2. ItemDataBound + = new Repeateritemeventhandler (rpt2_itemdatabound); The most important sentence //extract category ID cid = Convert.ToInt32 (rowv["ID"]); //Search for products under this category by Category ID and bind products repeater Rpt2. DataSource = PCATEGORY.GETP (CID);//Data binding RPT2. DataBind (); } } protected void rpt2_ ItemDataBound (object sender, RepeaterItemEventArgs e) { if (E.item.itemtype = = ListItemType.Item | | e.item.itemtype = listitemtype.alternatingitem) & nbsp; { Repeater RPT3 = ( Repeater) E.item.findcontrol ("Rpt3"); //Find the data items associated with the taxonomy repeater DataRowView rowvv = (DataRowView) e.Item.DataItem; //ExtractionCategory ID cid2 = Convert.ToInt32 (rowvv["ID"]); //Search for products under this category by Category ID and bind products repeater RPT3. DataSource = GETRPT3 (CID, CID2);//Data binding RPT3. DataBind (); } }
Reprinted from: http://www.aspnetjia.com
Repeater level Three nested bindings