protected WidgetContainer FindTheControl(string ControlName, Control X) { if (X is Page) { bFound = false; x = new WidgetContainer(); } foreach (Control c in X.Controls) { if (c.ID == ControlName && c is WidgetContainer) { bFound = true; x = (WidgetContainer)c; return x; } else { if (!bFound) { FindTheControl(ControlName, c); } } } return x; }
protected WidgetContainer FindTheControl(string ControlName, Control control) { if (control is Page) { bFound = false; widgetCtrl = new WidgetContainer(); } foreach (Control c in control.Controls) { if (c.ID == ControlName && c is WidgetContainer) { bFound = true; widgetCtrl = (WidgetContainer)c; return widgetCtrl; } else { if (!bFound) { FindTheControl(ControlName, c); } } } return widgetCtrl; }