Some days back I saw in a forum, the user wants to find TextBox or Label in a wizard control while using some custom template.
This code segment will help for finding out the controls in the control tree.
I am not doing anything, just searching the controls in a recursive way, if got that control returns it.
public Control FindMyControl(Control ctrl, string NameofControlToFind)
{
Control found = ctrl.FindControl(NameofControlToFind);
if (found != null)
return found;
else
{
foreach (Control item in ctrl.Controls)
{
return FindMyControl(item, NameofControlToFind);
}
}
return null;
}
Thanks,
Debata