Aug 26, 2011, 5:12 PM
[CLOSED] best way to traverse the server controls hierarchy of a page
Hi:
I need to traverse the server ext.net controls hierarchy that have been added to a page. I just want to make sure I am scanning all controls.
Would this do it:
Thank you
I need to traverse the server ext.net controls hierarchy that have been added to a page. I just want to make sure I am scanning all controls.
Would this do it:
private void DisplayUIControls(IndentedTextWriter writer, Control control)
{
Component xnetComponent = control as Component;
if (xnetComponent != null && !String.IsNullOrEmpty(xnetComponent.ItemID))
{
writer.WriteLine("// {0}", xnetComponent.ItemID);
}
foreach (Control child in control.Controls)
{
writer.Indent += 1;
DisplayUIControls(writer, child);
writer.Indent -= 1;
}
}
The reason I am asking is because for certain controls, let's say panels, they have multiple inner containers: Items, Buttons, TopBar, BottomBar. I want to make sure I am covering all these containers in one shot.Thank you
Last edited by geoffrey.mcgill; Aug 31, 2011 at 4:02 AM.
Reason: [CLOSED]