S
Steven K
Hello,
I just worked through finding controls on a page with and without a panel.
My question is how do you loop through controls if you are using a master
page and your content is inside the ContentHolder control?
Thanks in advance, Steven
Sub FindControlsInWebForm()
Dim strValue As String = ""
'Loop through controls
For Each ctlPage As Control In Page.Controls
If TypeOf ctlPage Is HtmlForm Then
For Each ctlChild As Control In ctlPage.Controls
If TypeOf ctlChild Is Label Then strValue &= "Page.Label.ID = " &
ctlChild.ID & ".ID<br>"
'Panel
If TypeOf ctlChild Is Panel Then
strValue = "Panel.ID = " & ctlChild.ID & ".ID<br>"
For Each ctlGrndChild As Control In ctlChild.Controls
If TypeOf ctlGrndChild Is TextBox Then strValue &=
"Panel.TextBox.ID = " & ctlGrndChild.ID & ".ID<br>"
Next ctlGrndChild
End If
Next ctlChild
End If
Next ctlPage
End Sub
I just worked through finding controls on a page with and without a panel.
My question is how do you loop through controls if you are using a master
page and your content is inside the ContentHolder control?
Thanks in advance, Steven
Sub FindControlsInWebForm()
Dim strValue As String = ""
'Loop through controls
For Each ctlPage As Control In Page.Controls
If TypeOf ctlPage Is HtmlForm Then
For Each ctlChild As Control In ctlPage.Controls
If TypeOf ctlChild Is Label Then strValue &= "Page.Label.ID = " &
ctlChild.ID & ".ID<br>"
'Panel
If TypeOf ctlChild Is Panel Then
strValue = "Panel.ID = " & ctlChild.ID & ".ID<br>"
For Each ctlGrndChild As Control In ctlChild.Controls
If TypeOf ctlGrndChild Is TextBox Then strValue &=
"Panel.TextBox.ID = " & ctlGrndChild.ID & ".ID<br>"
Next ctlGrndChild
End If
Next ctlChild
End If
Next ctlPage
End Sub