Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looping through all the controls
Message
 
To
20/01/2009 18:51:02
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01375750
Message ID:
01375884
Views:
6
>>I am using a Custom Control (based on a Panel) to contain all sorts of controls, which in turn contain all sorts of controls, which may contain all sorts of controls.
>>
>>I need to iterate through all the controls so that I can set the BindingSource at runtime. Does anyone know an easy way to get to all of the controls, a simple foreach at the top level won't cut it.
>
>Here is an example:
>
>
>        ' Loop through all the controls on the page and apply the business logic
>        ' expO1 Control
>        Public Function PageControlRecursiveLoop(ByVal toControl As Object) As Boolean
>            Dim lcKey As String = ""
>            Dim lcID As String = ""
>            Dim lcMessage As String = ""
>            Dim loControl As System.Web.UI.Control
>            Dim loControlButton As System.Web.UI.WebControls.Button
>            Dim loControlForm As System.Web.UI.HtmlControls.HtmlForm
>            Dim loControlImage As System.Web.UI.WebControls.Image
>            Dim loControlImageMap As System.Web.UI.WebControls.ImageMap
>            Dim loControlLabel As System.Web.UI.WebControls.Label
>
>            ' Label values
>            For Each loControl In toControl.Controls
Looked like a Localization kludge I did in 1.1

What a nightmare to pick that up and attempt to display the proper language for forms before localization.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform