M
Milsnips
hi there,
i have a strange problem. I want to programatically loop through each
control on a page, but am having issues.
my test example:
1. header.ascx - the ascx control finds all the child controls no problems
2. default.aspx - i dont find any controls that are placed directly on the
form.
i call the function as follows
AddControlsToDatabase(Me) - this is placed on every page_ for both ASPX
pages and ASCX pages.
my function is as follows:
Sub AddControlsToDatabase(ByVal mypage As Object)
For Each c As Control In mypage.controls
'hyperlink
If TypeOf c Is HyperLink Then
Dim l As HyperLink = CType(c, HyperLink)
'...my code goes here...
End If
'Button
If TypeOf c Is Button Then
Dim l As Button = CType(c, Button)
'...my code goes here...
End If
Next
End Sub
Any help is appreciated in why this doesnt pickup the ASPX page controls
within the Controls collection.
thanks,
Paul.
i have a strange problem. I want to programatically loop through each
control on a page, but am having issues.
my test example:
1. header.ascx - the ascx control finds all the child controls no problems
2. default.aspx - i dont find any controls that are placed directly on the
form.
i call the function as follows
AddControlsToDatabase(Me) - this is placed on every page_ for both ASPX
pages and ASCX pages.
my function is as follows:
Sub AddControlsToDatabase(ByVal mypage As Object)
For Each c As Control In mypage.controls
'hyperlink
If TypeOf c Is HyperLink Then
Dim l As HyperLink = CType(c, HyperLink)
'...my code goes here...
End If
'Button
If TypeOf c Is Button Then
Dim l As Button = CType(c, Button)
'...my code goes here...
End If
Next
End Sub
Any help is appreciated in why this doesnt pickup the ASPX page controls
within the Controls collection.
thanks,
Paul.