T
TK
I have x number of user controls that have a strong type (e.g.
className uc1). I am able to access their properties through a single
aspx page using:
uc = LoadControl(path to control based on querystring value)
textbox.Text = CType(uc, uc1).someproperty
The thing I need to do though is to specify the type (e.g. uc1) on the
fly based on the path created for that user control. For example
(ignoring declarations):
path = "path to user control directory"
'For each valid ucid there is a strong type associated with the
'user control using className in the ascx page.
ucid = request.querystring("ucid")
uc = LoadControl(path & ucid)
'Add the user control to the page
placeholder.Controls.Add(uc)
This is where I am stuck...
I need to access the properties of the control based on the ucid.
When I hard code it I use CType and specify the user control
className.
But in this case I do not know which user control will be called as it
depends on the ucid (all the user controls have the same properties).
There may 20-30 user controls and I would hate to have to hard code
each of the possibilities.
Ultimately I am looking for something like this:
path = "path to user control directory"
ucid = request.querystring("ucid")
uc = LoadControl(path & ucid)
placeholder.Controls.Add(uc)
textbox.text = uc.someproperty
Thx for any help or direction!
Tom
className uc1). I am able to access their properties through a single
aspx page using:
uc = LoadControl(path to control based on querystring value)
textbox.Text = CType(uc, uc1).someproperty
The thing I need to do though is to specify the type (e.g. uc1) on the
fly based on the path created for that user control. For example
(ignoring declarations):
path = "path to user control directory"
'For each valid ucid there is a strong type associated with the
'user control using className in the ascx page.
ucid = request.querystring("ucid")
uc = LoadControl(path & ucid)
'Add the user control to the page
placeholder.Controls.Add(uc)
This is where I am stuck...
I need to access the properties of the control based on the ucid.
When I hard code it I use CType and specify the user control
className.
But in this case I do not know which user control will be called as it
depends on the ucid (all the user controls have the same properties).
There may 20-30 user controls and I would hate to have to hard code
each of the possibilities.
Ultimately I am looking for something like this:
path = "path to user control directory"
ucid = request.querystring("ucid")
uc = LoadControl(path & ucid)
placeholder.Controls.Add(uc)
textbox.text = uc.someproperty
Thx for any help or direction!
Tom