I'm having problems looping through controls that are on my user control.
I have tried the following code, but cannot get it to find the checkboxes that are on the user control. (You can see some of my previous attempts that I have commented out.)
'For Each Ctrl As Control In Page.Controls
'For Each Ctrl As Control In Me.Page.Controls
'For Each ctrl As Control In Request.Form
'''Dim frm As Control = Me.FindControl("frmDefault")
'''For Each Ctrl As Control In frm.Controls
Dim Check As CheckBox
For Each Ctrl As Control In Me.Controls
If TypeOf Ctrl Is CheckBox Then
Check = Ctrl
' Do something here...
I finally figured out what is going on.
I have the checkboxes inside different tables. These tables contains runat="server". This table is inside a Div tag that also contains a runat="server".
My code could never find the checkboxes because of this. I had to add a For Each that loops through the Div tag and find the appropriate table(s). I then had to loop through the tables in order to find the checkboxes.