protected void Button2_Click(object sender, EventArgs e) { int iLevel; iLevel = 0; litProgramCaption.Text = myGetControlList(Form.Controls, ref iLevel); } private string myGetControlList(ControlCollection ccl, ref int iLevel) { StringBuilder sLines = new StringBuilder(); iLevel++; sLines.Length = 0; foreach (Control ct in ccl) { sLines.Append(iLevel); sLines.Append('-', iLevel); sLines.Append(ct.ID); sLines.Append("="); sLines.Append(ct.GetType()); sLines.Append("
"); if (ct.HasControls()) sLines.Append(myGetControlList(ct.Controls, ref iLevel)); } return sLines.ToString(); }