views:

11

answers:

1

Righty oh now I have a string which contains the name of a custom control class eg "MyBaseControl"

which in code its code file looks like

public class MyBaseControl : UserControl

I need to create an instance of this control using the string i recieve and add it to my page, i believe its something to do with

var fieldControl = (UIElement)typeof(MyBaseControl).Assembly.CreateInstance("MyBaseControl");

but field control returns null in this case, any ideas? :)

PS to extend this further eventually i want to make an instance of a subclass of this base class so var fieldControl = (UIElement)typeof(MyBaseControl).Assembly.CreateInstance("MySubControl");

A: 

Ive sorted it nevermind sorry the string being passed in i discovered needs the full namespace as well before the class name :)

lee