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 FindChildContro l(ByVal objSearchContro l As
System.Web.UI.C ontrol, _
ByVal strControlID As String) As Object
Dim objChildControl As System.Web.UI.C ontrol
Dim objControl As System.Web.UI.C ontrol
If objSearchContro l.Controls.Coun t = 0 Return Nothing
For Each objChildControl in objSearchContro l.Controls
objControl = FindChildContro l(objChildContr ol, strControlID)
If Not IsNothing(objCo ntrol) 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.c om> wrote in message
news:uY******** ******@TK2MSFTN GP10.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?