Posts

Showing posts with the label Finding controls

Recursive function to find controls & child controls in asp.net 2.0

The following method can be used to find controls and their child controls with help of recursion. public void FindControlsRecursively(Control oControl) { foreach (Control frmCtrl in oControl.Controls) { Response.Write(frmCtrl.GetType().ToString() + " "); if (frmCtrl.HasControls()) { FindControlsRecursively(frmCtrl); } } }