How do I accomplish the fallowing (is it even possible). Say I write a UserControl
"MyControl.ascx ". Now I use LoadControl("My Control.ascx"). But I really
want MyControl to require parameters in the constructor for example MyContorl
oMyControl = new MyContorl(emplo yeeid). However I need to load the control
at runtime so the have to call it this way LoadControl("My Control.ascx")
and I get an error that I have not supplied any parameter to the constructor.
Is there anyway around this? I guess I could change the control so that
I can insatiate it without supplying parameters and assigning the properties
later; but that doesn't seem like a very clean solution. Thanks in advance.
"MyControl.ascx ". Now I use LoadControl("My Control.ascx"). But I really
want MyControl to require parameters in the constructor for example MyContorl
oMyControl = new MyContorl(emplo yeeid). However I need to load the control
at runtime so the have to call it this way LoadControl("My Control.ascx")
and I get an error that I have not supplied any parameter to the constructor.
Is there anyway around this? I guess I could change the control so that
I can insatiate it without supplying parameters and assigning the properties
later; but that doesn't seem like a very clean solution. Thanks in advance.
Comment