These two methods will allow you to generically locate a collection of Controls on any webform.It recursively locates controls so no knowledge of control hierarchy is required. This bit of code come in very handy when dealing with repeaters.
///
/// Find all controls with specified ID
///
/// The control ID to search for
/// List of all controls found
public List FindControls(string ID)
{
List foundControls = new List();
this.FindControlsRecursive(ref foundControls, this.Master, ID);
return foundControls;
}
private List FindControlsRecursive(ref List foundControls, Control root, string ID)
{
foreach (Control ctrl in root.Controls)
{
if (ctrl.ID == ID)
foundControls.Add(ctrl);
FindControlsRecursive(ref foundControls, ctrl, ID);
}
return foundControls;
}