I have a User Control that can have self-referencing child controls. Here is the code I use where I create the children:
if (Source.Tables["Headings"] != null)
{
foreach (DataRow dr in Source.Tables["Headings"].Select("ParentHeading_Id="+RowID.ToString(), "DisplayOrder ASC"))
{
//These are child headings
HeadingRow hmr = (HeadingRow)LoadControl("HeadingRow.ascx");
hmr.Source = Source;
hmr.RowID = Convert.ToInt32(dr["Heading_Id"].ToString());
hmr.TestModuleId = TestModuleId;
hmr.NestLevel = this.NestLevel + 1;
phChildren.Controls.Add(hmr);
hmr.PopulateRow();
}
}
(phChildren is a placeholder on the usercontrol .ascx page)
The problem is that on postback, if I ...
Go to the complete details ...