B
Brandon Potter
Why is it that when I override the OnInit method for a page, I can add a
user control like this:
Me.Controls.Add(LoadControl("MyControl.ascx"))
(where MyControl.ascx is your every day user control)
.... but when I use:
Dim mC As New MyControl
Me.Controls.Add(mC)
.... it doesn't show up?
It works if use the generic Control type:
Dim mC As Control
mC = LoadControl("MyControl.ascx")
Me.Controls.Add(mC)
I thought ASP.NET would add user controls to a page just the same as
controls... am I missing something?
Brandon
user control like this:
Me.Controls.Add(LoadControl("MyControl.ascx"))
(where MyControl.ascx is your every day user control)
.... but when I use:
Dim mC As New MyControl
Me.Controls.Add(mC)
.... it doesn't show up?
It works if use the generic Control type:
Dim mC As Control
mC = LoadControl("MyControl.ascx")
Me.Controls.Add(mC)
I thought ASP.NET would add user controls to a page just the same as
controls... am I missing something?
Brandon