LoadControl() and Constructor Parameters
From: Sam Kuehn (samkuehn_at_hotmail.com)
Date: 02/10/05
- Next message: Wayne Wengert: "Error Trying to Run"
- Previous message: Peter Rilling: "Re: Connection String Help"
- Next in thread: Scott Allen: "Re: LoadControl() and Constructor Parameters"
- Reply: Scott Allen: "Re: LoadControl() and Constructor Parameters"
- Reply: Hasani Blackwell: "Re: LoadControl() and Constructor Parameters"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Feb 2005 13:25:41 -0800
How do I accomplish the fallowing (is it even possible). Say I write a UserControl
"MyControl.ascx". Now I use LoadControl("MyControl.ascx"). But I really
want MyControl to require parameters in the constructor for example MyContorl
oMyControl = new MyContorl(employeeid). However I need to load the control
at runtime so the have to call it this way LoadControl("MyControl.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.
- Next message: Wayne Wengert: "Error Trying to Run"
- Previous message: Peter Rilling: "Re: Connection String Help"
- Next in thread: Scott Allen: "Re: LoadControl() and Constructor Parameters"
- Reply: Scott Allen: "Re: LoadControl() and Constructor Parameters"
- Reply: Hasani Blackwell: "Re: LoadControl() and Constructor Parameters"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|