I have a TabContainer with some TabPanels. I wrote this loop through it and find specific controls:
foreach (TabPanel t in ContactTabContainer.Tabs)
{
if (t.ID == "DentalPanel")
{
foreach (object ctrl in t.Controls)
{
if (ctrl is Control)
{
Control c = (Control)ctrl;
foreach (object innerCtrl in c.Controls)
{
if (innerCtrl is TextBox)
{
TextBox txt = (TextBox)innerCtrl;
//code
}
}
}
}
}
}
Is there a more efficient way of doing this? This seems so cumbersome to me. I could be wrong and it may be exactly right, but I need someone elses opinion.
Thanks!