Posts
400
Comments
213
Trackbacks
0
Recursiv Controls finden

Fürs Archiv:

Public Shared Function FindControlRecursive(ByVal Root As Control, ByVal FindID As String) As Control

   Dim foundctl As Control

   If Root Is Nothing Then Return Nothing

   If Root.ID = FindID Then Return Root

   For Each ctl As Control In Root.Controls

      foundctl = FindControlRecursive(ctl, FindID)

      If foundctl IsNot Nothing Then

         Return foundctl

      End If

   Next

   Return Nothing

End Function

 

 

Public Shared Function FindControlInAllParents(ByVal Root As System.Web.UI.Control, ByVal FindID As String) As System.Web.UI.Control

   Dim temp As System.Web.UI.Control = Nothing

   While Root IsNot Nothing

      temp = FindControlRecursive(Root, FindID)

      If temp Is Nothing Then

         Root = Root.Parent

      Else

         Root = Nothing

      End If

   End While

   Return temp

End Function

posted on Friday, June 26, 2009 8:02 AM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 3 and 3 and type the answer here: