我想做的是这个
<asp:Repeater ID="ParentRepeater" runat="server" OnItemDataBound="ItemBound">
<ItemTemplate>
<asp:Repeater ID="Repeater_SideMenu_Guides_Medlem" runat="server">
<ItemTemplate>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
代码隐藏
ParentRepeater.DataSource = CraftGuides.GetAllGroups();
ParentRepeater.DataBind();
protected void ItemBound(object sender, RepeaterItemEventArgs args)
{
if (args.Item.ItemType == ListItemType.Item)
{
Repeater childRepeater = (Repeater)args.Item.FindControl("ChildRepeater");
childRepeater.DataSource = CraftGuides.GetGuidesByGroupID( Insert ID from Parent Here );
childRepeater.DataBind();
}
}
现在,问题是我不知道从孩子内部的父母那里获取 ID 以从数据库中收集数据