I am working on a Web Application that can dynamically load
UserControls, a la a plugin style system. When I create any new
controls within the project, all is fine.
What my question is, would be how might I be able to allow someone to
create a plugin that would not require that I rebuild the application -
or is it even possible? Right now, this is what I have:
A BasePage class that inherits from System.Web.UI.Page that is used to
extend the Page object for extended rendering functionality.
A BaseControl class that inherits from System.Web.UI.UserControl that
is used to extend the UserControl object for specific rendering
capabilities that are used by all plugins.
I have a page that inherits from BasePage. To it, I've added a
PlaceHolder control. Then on Page_Load, I simply use LoadControl to
load the specific control and add it to the PlaceHolder. My ultimate
goal would be to build up a repository of these objects in a database
so that I could configure certain controls to be used in certain
situations. Basically, it is a CMS-type application.
Like I mentioned, as long as the control exists in the main project,
all is well. But assume that a third party wants to develop a plugin.
I don't want to give access to the code to that person, for obvious
reasons.
Are my options limited to adding the DLL from the plugin to the /bin
folder of the main application? After I do that, how do I get the
application to recongize the DLL? If I put them in a subfolder
structure to keep them organized, does this impact anything in regards
to the ability to load the control?
Thank you, in advance, for any input.
Joseph 1 1221
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chua Wen Ching |
last post by:
Hi there,
I had some doubts on creatings plugins.
As most example on the internet shows how to write plugins onto a plugin
host which is normally a windows form program.
1) Can i replace...
|
by: Tamir Khason |
last post by:
Friends, maybe someone knows good references for .NET plugin based program
architecture. E.g I want to be able to "put" class library(dll) in some
place (where I do not the name of the class, but...
|
by: Matt |
last post by:
I'm hoping someone can steer me in the right direction to try to do the
following:
I am developing an application where we receive files from customers. Right
now we receive a variety of...
|
by: CSharpNewBie |
last post by:
Hi
I am looking to create a Plugin Architecture. I looked at this extend or
enhance the User Interface (UI) article
http://www.codeproject.com/csharp/extensibleui.asp
and It looks good and I...
|
by: rodchar |
last post by:
Hey all,
I'm trying to understand Master/Detail concepts in VB.NET. If I do a data
adapter fill for both customer and orders from Northwind where should that
dataset live?
What client is...
| |
by: rudolf.ball |
last post by:
Dear NG,
I have a question about the architecture of my ASP.NET 2.0 site:
Users can have custom features, I call it plugins. A plugin can be
UserAdministration, ProductAdministration,...
|
by: Olie |
last post by:
I was quite surprised to find virtually nothing about this but I may
have been searching for the wrong thing.
I want to know the best way to provide a programming interface to a
plugin. I...
|
by: =?UTF-8?B?R3J6ZWdvcnogU8WCb2Rrb3dpY3o=?= |
last post by:
I'm working on my little project (an IM client) which I wanted to
support plugins. My idea was that the core program would by itself do
virtually nothing but manage plugins and all functionality...
|
by: jmDesktop |
last post by:
I'm using C#, but I don't know that it matters for this question. I
know that many experienced folks are on here, so sorry for being off
topic. I am finally at a point where I want to and I think...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |