Hi all,
I need to iterate through web pages controls using reflection.
However when I create an instance of the web page, the controls
collection is empty.
Can anyone help ?
here's the code used:
Dim myAssembly As System.Reflecti on.Assembly
myAssembly = myAssembly.Load ("App_Web")
Dim definedTypes As Type() = myAssembly.GetT ypes
Dim myType As Type
For Each myType In definedTypes
Dim myPage As System.Web.UI.P age
Dim j As Integer
If myType.BaseType .Name = "Page" Then
myPage = myAssembly.Crea teInstance(myTy pe.FullName)
Debug.WriteLine ("myPage.Contro ls.Count=" +
myPage.Controls .Count.ToString )
For j = 0 To myPage.Controls .Count - 1
'Do something
Next
End If
Next
*** Sent via Developersdex http://www.developersdex.com ***
Comment