Blog Stats
  • Posts - 170
  • Articles - 4
  • Comments - 54
  • Trackbacks - 7

 

Loop and display the ControlCollection

Use this snippet  if you have to loop through a nested controls collection:

Sub LoopControls(ByVal cntrls As ControlCollection)

        Dim Control As Control
        Response.Write("<ol>")

        Dim Index As Int32 = -1

        For Each Control In cntrls
            Index += 1

            Response.Write("<LI>" & Control.GetType.ToString & " Index " & Index)
            If Control.Controls.Count > 0 Then
                LoopControls(Control.Controls)
            End If
        Next

        Response.Write("</ol>")

    End Sub

Comments have been closed on this topic.
 

 

Copyright © Paschal L