-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelperClass.vb
31 lines (30 loc) · 1.21 KB
/
HelperClass.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Imports DevExpress.Web
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Module HelperClass
Public Function GetChildControls(ByVal container As Object, ByVal predicate As Func(Of Control, Boolean)) As List(Of ASPxEdit)
Return GetChildControls(container, New List(Of ASPxEdit)(), predicate)
End Function
Public Function GetChildControls(ByVal container As Object) As List(Of ASPxEdit)
Return GetChildControls(container, New List(Of ASPxEdit)(), Nothing)
End Function
Private Function GetChildControls(ByVal Container As Object, ByVal controlsList As List(Of ASPxEdit), ByVal predicate As Func(Of Control, Boolean)) As List(Of ASPxEdit)
Dim c As Control = TryCast(Container, Control)
If c Is Nothing OrElse c.Controls.Count = 0 Then
Return controlsList
End If
For Each item As Control In c.Controls
If TypeOf item Is ASPxEdit AndAlso (predicate Is Nothing OrElse predicate(item) = True) Then
controlsList.Add(CType(item, ASPxEdit))
End If
If item.Controls.Count > 0 Then
controlsList = GetChildControls(item, controlsList, predicate)
End If
Next item
Return controlsList
End Function
End Module