This is a perfect place to employ Recursion. Most likely there's an HTML table containing the controls, each cell will also be returned as an object in the .Controls property collection. so, not only will you have to iterate through the placeholder's controls, but each of their controls as well. Here's a skeleton of a recursive function i've used to do exactly that.
The purpose of this function was to iterate through a dynamically built list of checkboxes and build a string of their values (but since they dont have values, i'm cheating and storing their ID value in the CssClass property, anyway...).
I'm sure you can get what you need out of this:
Code:
Function GetFieldDefs(ByVal sFieldDefs As String, Optional ByVal ctl As Control = Nothing) As String
Dim chk As CheckBox
Dim ctl2 As Control
'this is a recursive function to walk the tree structure of the control hierarchy
If ctl Is Nothing Then
For Each ctl2 In Me.Controls
If ctl2.HasControls Then
sFieldDefs = GetFieldDefs(sFieldDefs, ctl2)
Else
'there are no more child controls - lets walk through the current set
If ctl2.GetType.ToString = "System.Web.UI.WebControls.CheckBox" Then
chk = CType(ctl2, System.Web.UI.WebControls.CheckBox)
If chk.Checked = True And chk.CssClass <> "" Then
sFieldDefs += chk.CssClass & ","
End If
End If
End If
Next
Else
For Each ctl2 In ctl.Controls
If ctl2.HasControls Then
sFieldDefs = GetFieldDefs(sFieldDefs, ctl2)
Else
'there are no more child controls - lets walk through the current set
If ctl2.GetType.ToString = "System.Web.UI.WebControls.CheckBox" Then
chk = CType(ctl2, System.Web.UI.WebControls.CheckBox)
If chk.Checked = True And chk.CssClass <> "" Then
sFieldDefs += chk.CssClass & ","
End If
End If
End If
Next
End If
Return sFieldDefs
End Function
Hope this helps.
john
MCSD(VB6)
http://www.stlvbug.org