N
Naim
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.Reflection.Assembly
myAssembly = myAssembly.Load("App_Web")
Dim definedTypes As Type() = myAssembly.GetTypes
Dim myType As Type
For Each myType In definedTypes
Dim myPage As System.Web.UI.Page
Dim j As Integer
If myType.BaseType.Name = "Page" Then
myPage = myAssembly.CreateInstance(myType.FullName)
Debug.WriteLine("myPage.Controls.Count=" +
myPage.Controls.Count.ToString)
For j = 0 To myPage.Controls.Count - 1
'Do something
Next
End If
Next
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.Reflection.Assembly
myAssembly = myAssembly.Load("App_Web")
Dim definedTypes As Type() = myAssembly.GetTypes
Dim myType As Type
For Each myType In definedTypes
Dim myPage As System.Web.UI.Page
Dim j As Integer
If myType.BaseType.Name = "Page" Then
myPage = myAssembly.CreateInstance(myType.FullName)
Debug.WriteLine("myPage.Controls.Count=" +
myPage.Controls.Count.ToString)
For j = 0 To myPage.Controls.Count - 1
'Do something
Next
End If
Next