Interesting fact...
LoadControl worked well for me
(Page.LoadControl("~/subfolders/UserControl.ascx"),
but when I tried programmatically add it like this
dim ucMyUserControl as UserControl
ucMyUserControl = new UserControl
I got "reference to null" error...
How come?
So what's the way to create/load UC dynamically according to language
reference? Thanks.
--
With the best wishes,
Shaul Feldman
"one" <on***********@onlins.nospam> wrote in message
news:0B**********************************@microsof t.com...
I can see what you are trying to do.
According to msdn help, the 'LoadControl' method takes (string
virtualPath) as the arguement. And the 'virtualPath' specified the 'virtual
path to a user control file'
That means you cannot load 'custom control' that way.
You can try doing something like this (in your user controls):
MyCustomControl mcc = new MyCustomControl();
You can also consider using Rendered Custom Controls, which you can
programmatically stream out html.
HTH