-3

To be fair, this is a part two follow up to Using C# to recursively get a collection of controls from a controlcollection - and rather than heap another question onto the old one, I created a new one. Here is the code that I'm using:

private void GetControlList<T>(ControlCollection controlCollection, ref List<T> resultCollection) where T : Control 
{
    foreach (Control control in controlCollection)
    {
        if (control.HasControls())
            GetControlList(control.Controls, ref resultCollection);
        else if (control is T)
            resultCollection.Add((T)control);
    }
}

and is involked like this when the form is submitted

List<CheckBox> checkboxes = new List<CheckBox>();
GetControlList(RepeaterCapability.Controls, ref checkboxes);

The problem is that I don't get any results when I clearly added several during the repeater OnItemDataBound event. Any ideas?

Community
  • 1
  • 1
Andy Evans
  • 6,997
  • 18
  • 72
  • 118

2 Answers2

0

Have you checked the Repeater.Items property?

sisve
  • 19,501
  • 3
  • 53
  • 95
-1

REsolved ... PEBKAC

Andy Evans
  • 6,997
  • 18
  • 72
  • 118