You can loop through the controls collection.
However it gets complicated if you have controls nested within other
container controls.
Here's some code Kevin Spencer posted a while back that provides a good
demonstration using recursion.
Private Function FindChildControl(ByVal objSearchControl As
System.Web.UI.Control, _
ByVal strControlID As String) As Object
Dim objChildControl As System.Web.UI.Control
Dim objControl As System.Web.UI.Control
If objSearchControl.Controls.Count = 0 Return Nothing
For Each objChildControl in objSearchControl.Controls
objControl = FindChildControl(objChildControl, strControlID)
If Not IsNothing(objControl) Return objControl
Next
Return Nothing
End Function
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at
http://www.able-consulting.com
"David A. Beck" <da****@beckb.com> wrote in message
news:uY**************@TK2MSFTNGP10.phx.gbl...
Is there a way I can loop through a form object in ASP.NET codebehind like
in VB.NET and get all of the controls?