Re: Question Regarding Plugin Architecture
- From: "Joseph Ferris" <joseph.ferris@xxxxxxxxx>
- Date: 27 Nov 2005 08:57:38 -0800
I have made some progress. What I am doing now, instead of
LoadControl, is I am creating a reference to the Assembly by using
Assembly.LoadFrom(). I then cast it to the correct control type and
assign it to the control collection of a placeholder on the calling
page. This is what I have in my Page_Load on the ASPX page:
Dim MyPlaceHolder As PlaceHolder =
CType(Me.FindControl("TemplateHolder"), PlaceHolder)
If Not MyPlaceHolder Is Nothing Then
Dim DynamicASM As [Assembly]
DynamicASM =
DynamicASM.LoadFrom(Server.MapPath("./New/bin/New.dll"))
Dim ControlInstance As MyLib.Page.Controls.Template =
CType(DynamicASM.CreateInstance("New.Index"),
MyLib.Page.Controls.Template)
MyPlaceHolder.Controls.Add(ControlInstance)
ControlInstance.TestOutput()
End If
The TestOutput() method is defined in the base control instance, and
outputs "Base" to the screen when called, if it is not overriden. I
override it in the derived instance to display "Derived". When I run
the above code, it displays "Derived". But now, my new problem...
Any content in the derived control is not displayed. For example, I
added a table in the designer and recompiled. The instance I create
from the assembly is displaying "Derived", so it is creating it. The
events of the derived control are also being hit correctly, if I add
breakpoints in the debugger. I just can't get the table to show. I am
assuming that something is happening in LoadControl that this approach
does not do.
Does anyone have any idea as to might what be going on, or have a
better approach to this? I am feeling a little lost at the moment.
;-)
Thanks!
Joseph
.
- References:
- Question Regarding Plugin Architecture
- From: Joseph Ferris
- Question Regarding Plugin Architecture
- Prev by Date: Re: passing parameters from page to page
- Next by Date: Re: VS2005 Class Designer Weirdness
- Previous by thread: Question Regarding Plugin Architecture
- Next by thread: Mike Taylor?
- Index(es):
Relevant Pages
|