Find control recursive
private Control FindControlRecursive(Control parentControl, string controlId)
{
Control foundControl = null;
if (parentControl.Controls != null && parentControl.Controls.Count > 0)
{
foundControl = parentControl.FindControl(controlId);
if (foundControl == null)
{
foreach (Control control in parentControl.Controls)
{
foundControl = FindControlRecursive(control, controlId);
if (foundControl != null)
return foundControl;
}
}
else
{
return foundControl;
}
}
return foundControl;
}