D
darrel
This is a follow-up to a question I asked yesterday.
I'm loading a UC programatically as such:
===================================================
public customContentControl as UserControl
customContentControl =
CType(Page.LoadControl("mycontrol.ascx"),UserControl)panel_controlHolder.Con
trols.Add(customContentControl)
===================================================
This works fine, but got hung up on how to now pass a property or variable
value to this loaded control.
It was suggested to use a base class or an interface. I've done a bit with
interfaces, but wanted to try understanding how the base class option would
be imnplemented.
What I eventually would like to be able to do is pass a value like this:
===================================================
customContentControl.property = 'whatever'
===================================================
Now, from what I understand, my problem is that I'm casting the loaded UC as
a 'UserControl' instead of a base-class derived from the UserControl class.
Am I on the right path with that logic? If so, what does the base-class
definition do. Is it merely creating a namespace so I can access it?
I'm loading a UC programatically as such:
===================================================
public customContentControl as UserControl
customContentControl =
CType(Page.LoadControl("mycontrol.ascx"),UserControl)panel_controlHolder.Con
trols.Add(customContentControl)
===================================================
This works fine, but got hung up on how to now pass a property or variable
value to this loaded control.
It was suggested to use a base class or an interface. I've done a bit with
interfaces, but wanted to try understanding how the base class option would
be imnplemented.
What I eventually would like to be able to do is pass a value like this:
===================================================
customContentControl.property = 'whatever'
===================================================
Now, from what I understand, my problem is that I'm casting the loaded UC as
a 'UserControl' instead of a base-class derived from the UserControl class.
Am I on the right path with that logic? If so, what does the base-class
definition do. Is it merely creating a namespace so I can access it?