I am writing an application that dynamically loads user controls at run time
based on user options. I would like to give my users the ability to build
their own user controls and add them to my user control folder so that they
can be selected and loaded at run time also. These new controls will need to
have access to many of the classes with there properties and methods within
the complied code. Is this possible? This seems to be the reverse of most
situations where the programmer accesses an object and uses its
functionality. I want my code to dynamically load a new user control created
by a programmer who does not have access to my source code. Is there any
reference material on doing such a thing?
Thanks for you help!!!
Earl 6 2563
With interface file client can compile UserControl code without have your
page code!
If your pages or classes expose a public interface you can do this.
Example :
public interface IA
{
....
void Pippo();
}
public class A : IA
{
...
public void Pippo() { ... };
}
public interface IPublicPageForU ser
{
....
IA GetAObject();
}
public MyPage : Page, IPublicPageForU ser
{
public IA GetAObject()
{
A aObj = new A();
return (IA)aObj;
}
}
the user control retrieve the object A with :
IA aObj = ((IPublicPageFo rUser)this.Page ).GetAObject()
aObj.Pippo();
I hope that my example is clear and good for your work.
Brun
"Earl Teigrob" <ea******@hotma il.com> wrote in message
news:ey******** ******@TK2MSFTN GP12.phx.gbl... I am writing an application that dynamically loads user controls at run
time based on user options. I would like to give my users the ability to build their own user controls and add them to my user control folder so that
they can be selected and loaded at run time also. These new controls will need
to have access to many of the classes with there properties and methods
within the complied code. Is this possible? This seems to be the reverse of most situations where the programmer accesses an object and uses its functionality. I want my code to dynamically load a new user control
created by a programmer who does not have access to my source code. Is there any reference material on doing such a thing?
Thanks for you help!!!
Earl
With interface file client can compile UserControl code without have your
page code!
If your pages or classes expose a public interface you can do this.
Example :
public interface IA
{
....
void Pippo();
}
public class A : IA
{
...
public void Pippo() { ... };
}
public interface IPublicPageForU ser
{
....
IA GetAObject();
}
public MyPage : Page, IPublicPageForU ser
{
public IA GetAObject()
{
A aObj = new A();
return (IA)aObj;
}
}
the user control retrieve the object A with :
IA aObj = ((IPublicPageFo rUser)this.Page ).GetAObject()
aObj.Pippo();
I hope that my example is clear and good for your work.
Brun
"Earl Teigrob" <ea******@hotma il.com> wrote in message
news:ey******** ******@TK2MSFTN GP12.phx.gbl... I am writing an application that dynamically loads user controls at run
time based on user options. I would like to give my users the ability to build their own user controls and add them to my user control folder so that
they can be selected and loaded at run time also. These new controls will need
to have access to many of the classes with there properties and methods
within the complied code. Is this possible? This seems to be the reverse of most situations where the programmer accesses an object and uses its functionality. I want my code to dynamically load a new user control
created by a programmer who does not have access to my source code. Is there any reference material on doing such a thing?
Thanks for you help!!!
Earl
Bruno, I've been playing with this for a case very similar to Earl's. Your example is a big help--thank you
One thing, can you or anybody explain the differences/implications of creating an interface versus using operations in the system.reflecti on class, or is that sort of the same thing? Maybe the difference between early and late binding
For example (vb syntax), from within my user control
Dim mi As System.Reflecti on.MethodInf
mi = Page.GetType.Ge tMethod("PageFu nction"
mi.Invoke(Page, Nothing
If I have a function called PageFunction on the page that I load this user control from, it gets called from the user control, and I can pass parameters, etc
Any thoughts
Thanks
Bil
Earl, afaik, you're on exactly the right track--getting them from disk at runtime is one of the big advantages of user controls. There's a pretty good discussion of dynamic user controls in Walther's ASP.NET Unleashed book, but it stops short of telling you how to go back and get methods and properties in the parent page
----- Bruno Sirianni wrote: ----
With interface file client can compile UserControl code without have you
page code
If your pages or classes expose a public interface you can do this
Example
public interface I
...
void Pippo()
public class A : I
..
public void Pippo() { ... }
public interface IPublicPageForU se
...
IA GetAObject()
public MyPage : Page, IPublicPageForU se
public IA GetAObject(
A aObj = new A()
return (IA)aObj
the user control retrieve the object A with
IA aObj = ((IPublicPageFo rUser)this.Page ).GetAObject(
aObj.Pippo()
I hope that my example is clear and good for your work
Bru
"Earl Teigrob" <ea******@hotma il.com> wrote in messag
news:ey******** ******@TK2MSFTN GP12.phx.gbl.. I am writing an application that dynamically loads user controls at ru
tim based on user options. I would like to give my users the ability to buil their own user controls and add them to my user control folder so tha
the can be selected and loaded at run time also. These new controls will nee
t have access to many of the classes with there properties and method
withi the complied code. Is this possible? This seems to be the reverse of mos situations where the programmer accesses an object and uses it functionality. I want my code to dynamically load a new user contro
create by a programmer who does not have access to my source code. Is there an reference material on doing such a thing Thanks for you help!! Ear
Bruno, I've been playing with this for a case very similar to Earl's. Your example is a big help--thank you
One thing, can you or anybody explain the differences/implications of creating an interface versus using operations in the system.reflecti on class, or is that sort of the same thing? Maybe the difference between early and late binding
For example (vb syntax), from within my user control
Dim mi As System.Reflecti on.MethodInf
mi = Page.GetType.Ge tMethod("PageFu nction"
mi.Invoke(Page, Nothing
If I have a function called PageFunction on the page that I load this user control from, it gets called from the user control, and I can pass parameters, etc
Any thoughts
Thanks
Bil
Earl, afaik, you're on exactly the right track--getting them from disk at runtime is one of the big advantages of user controls. There's a pretty good discussion of dynamic user controls in Walther's ASP.NET Unleashed book, but it stops short of telling you how to go back and get methods and properties in the parent page
----- Bruno Sirianni wrote: ----
With interface file client can compile UserControl code without have you
page code
If your pages or classes expose a public interface you can do this
Example
public interface I
...
void Pippo()
public class A : I
..
public void Pippo() { ... }
public interface IPublicPageForU se
...
IA GetAObject()
public MyPage : Page, IPublicPageForU se
public IA GetAObject(
A aObj = new A()
return (IA)aObj
the user control retrieve the object A with
IA aObj = ((IPublicPageFo rUser)this.Page ).GetAObject(
aObj.Pippo()
I hope that my example is clear and good for your work
Bru
"Earl Teigrob" <ea******@hotma il.com> wrote in messag
news:ey******** ******@TK2MSFTN GP12.phx.gbl.. I am writing an application that dynamically loads user controls at ru
tim based on user options. I would like to give my users the ability to buil their own user controls and add them to my user control folder so tha
the can be selected and loaded at run time also. These new controls will nee
t have access to many of the classes with there properties and method
withi the complied code. Is this possible? This seems to be the reverse of mos situations where the programmer accesses an object and uses it functionality. I want my code to dynamically load a new user contro
create by a programmer who does not have access to my source code. Is there an reference material on doing such a thing Thanks for you help!! Ear
Reflection code is slow. With Reflection you can invoche all method and can
see all code! This is not good idea if you don't now who use your code!
If I declare a function private is because this can be used only by my code
class. If another class invoke this function in the wrong way can make
disaster an application, or not?
If your class expose a public interface you can use this without now its
Type.
interface IHello
{
void write();
}
class Hello : IHello //english class
{
public void write()
{
Console.Writeln ("Hello");
}
}
class Ciao : IHello //italian class
{
public void write()
{
Console.Writeln ( "Ciao");
}
}
//Program
void Begin(IHello h)
{
h.write();
}
if IHello is Ciao class the program write "Ciao" otherwise write "Hello",
but your code never change!
Interface can be compiled in separated project so you can have dll with only
interface and no code. User in this way can develop UserControl without your
code!
Brun
"Bill Borg" <an*******@disc ussions.microso ft.com> wrote in message
news:3C******** *************** ***********@mic rosoft.com... Bruno, I've been playing with this for a case very similar to Earl's.
Your example is a big help--thank you! One thing, can you or anybody explain the differences/implications of
creating an interface versus using operations in the system.reflecti on
class, or is that sort of the same thing? Maybe the difference between
early and late binding? For example (vb syntax), from within my user control: Dim mi As System.Reflecti on.MethodInfo mi = Page.GetType.Ge tMethod("PageFu nction") mi.Invoke(Page, Nothing)
If I have a function called PageFunction on the page that I load this user
control from, it gets called from the user control, and I can pass
parameters, etc. Any thoughts?
Thanks,
Bill
Earl, afaik, you're on exactly the right track--getting them from disk at
runtime is one of the big advantages of user controls. There's a pretty
good discussion of dynamic user controls in Walther's ASP.NET Unleashed
book, but it stops short of telling you how to go back and get methods and
properties in the parent page. ----- Bruno Sirianni wrote: -----
With interface file client can compile UserControl code without have
your page code!
If your pages or classes expose a public interface you can do this.
Example :
public interface IA { .... void Pippo(); }
public class A : IA { ... public void Pippo() { ... }; }
public interface IPublicPageForU ser { .... IA GetAObject(); }
public MyPage : Page, IPublicPageForU ser { public IA GetAObject() { A aObj = new A(); return (IA)aObj; } }
the user control retrieve the object A with :
IA aObj = ((IPublicPageFo rUser)this.Page ).GetAObject() aObj.Pippo();
I hope that my example is clear and good for your work.
Brun
"Earl Teigrob" <ea******@hotma il.com> wrote in message news:ey******** ******@TK2MSFTN GP12.phx.gbl... > I am writing an application that dynamically loads user controls at
run time > based on user options. I would like to give my users the ability to
build > their own user controls and add them to my user control folder so
that they > can be selected and loaded at run time also. These new controls
will need to > have access to many of the classes with there properties and
methods within > the complied code. Is this possible? This seems to be the reverse
of most > situations where the programmer accesses an object and uses its > functionality. I want my code to dynamically load a new user
control created > by a programmer who does not have access to my source code. Is
there any > reference material on doing such a thing? >> Thanks for you help!!! >> Earl >>
Again, very very helpful, thank you sir
----- Bruno Sirianni wrote: ----
Reflection code is slow. With Reflection you can invoche all method and ca
see all code! This is not good idea if you don't now who use your code
If I declare a function private is because this can be used only by my cod
class. If another class invoke this function in the wrong way can mak
disaster an application, or not
If your class expose a public interface you can use this without now it
Type
interface IHell
void write()
class Hello : IHello //english clas
public void write(
Console.Writeln ("Hello")
class Ciao : IHello //italian clas
public void write(
Console.Writeln ( "Ciao")
//Progra
void Begin(IHello h
h.write()
if IHello is Ciao class the program write "Ciao" otherwise write "Hello"
but your code never change
Interface can be compiled in separated project so you can have dll with onl
interface and no code. User in this way can develop UserControl without you
code
Bru
"Bill Borg" <an*******@disc ussions.microso ft.com> wrote in messag
news:3C******** *************** ***********@mic rosoft.com.. Bruno, I've been playing with this for a case very similar to Earl's
Your example is a big help--thank you One thing, can you or anybody explain the differences/implications o
creating an interface versus using operations in the system.reflecti o
class, or is that sort of the same thing? Maybe the difference betwee
early and late binding For example (vb syntax), from within my user control Dim mi As System.Reflecti on.MethodInf mi = Page.GetType.Ge tMethod("PageFu nction" mi.Invoke(Page, Nothing If I have a function called PageFunction on the page that I load this use
control from, it gets called from the user control, and I can pas
parameters, etc Any thoughts Thanks Bil Earl, afaik, you're on exactly the right track--getting them from disk a
runtime is one of the big advantages of user controls. There's a prett
good discussion of dynamic user controls in Walther's ASP.NET Unleashe
book, but it stops short of telling you how to go back and get methods an
properties in the parent page ----- Bruno Sirianni wrote: ---- With interface file client can compile UserControl code without hav
you page code If your pages or classes expose a public interface you can do this Example public interface I ... void Pippo()
public class A : I
.. public void Pippo() { ... }
public interface IPublicPageForU se
... IA GetAObject()
public MyPage : Page, IPublicPageForU se
public IA GetAObject(
A aObj = new A() return (IA)aObj
the user control retrieve the object A with IA aObj = ((IPublicPageFo rUser)this.Page ).GetAObject( aObj.Pippo() I hope that my example is clear and good for your work Bru "Earl Teigrob" <ea******@hotma il.com> wrote in messag news:ey******** ******@TK2MSFTN GP12.phx.gbl.. I am writing an application that dynamically loads user controls a
ru tim based on user options. I would like to give my users the ability t
buil their own user controls and add them to my user control folder s
that they can be selected and loaded at run time also. These new controls
will need to have access to many of the classes with there properties and
methods within the complied code. Is this possible? This seems to be the reverse
of most situations where the programmer accesses an object and uses its functionality. I want my code to dynamically load a new user
control created by a programmer who does not have access to my source code. Is
there any reference material on doing such a thing? Thanks for you help!!! Earl
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt Billock |
last post by:
Hello all,
I was wondering if anyone could provide me with some assistance with
and error I have been observing. Our current set of framework .dlls
defines custom user controls in an assembly called
Architecture.Web.DLL. One of the controls within that assembly
references an enumeration in another framework .DLL -
Architecture.services.dll. Both assemblies are strongly named.
The target deployment scenario for our framework is to have...
|
by: Moojjoo |
last post by:
Ok fellow C# developers:
How do creat an instance of an object inside a dataset or datagrid.
Example I need to have a placeholder inside a dataset. Any help would be
great.
|
by: Earl Teigrob |
last post by:
I am writing an application that dynamically loads user controls at run time
based on user options. I would like to give my users the ability to build
their own user controls and add them to my user control folder so that they
can be selected and loaded at run time also. These new controls will need to
have access to many of the classes with there properties and methods within
the complied code. Is this possible? This seems to be the...
|
by: Wardeaux |
last post by:
All,
Wanting to find a way to create web pages to add to my website without
having to recompile the codebehind everytime I want to add a new one...
Here's the deal:
I have a web app that takes work orders for 7 different items, each item
gets 1 page for input specs. All works well. I want to add a new item. I
do not want to recompile and redistribute my app everytime just to add a new
input page. Can ASPX resources be compiled into a...
|
by: Gordo |
last post by:
Hi,
I have written a number of server controls to build the company's
intranet from data held in an Oracle database. Everything works well
for the various navigation pages.
However, the content pages are in the main converted .htm pages with no
code behind. The issue I have is that I wish to place a small
navigation server control on each page. All works well if I compile the
pages with the solution referencing the server control dll....
| |
by: Paul |
last post by:
Hi I am trying to conditionally hide a user control on a form in the code.
There is a visible element in the properties box of the user control but in
the .vb file (in the code) the object does not seem available. Using me. the
intellsince does not show the user control name, so can not seem to get to
its properties in code.
Thanks.
Paul G
Software engineer.
|
by: Brian Kitt |
last post by:
I have a C# application that builds dynamic HTML and renders it. Because it
is rendered in this way, the input controls are not server controls. I write
the entire page, which has a variable number of detail lines for an order. I
want the user to be able to change values on these detail lines and hit an
'update' button. I know how to do this in Javascript, but I'd like to be
able to inspect the controls that come back to my C# program...
|
by: Jeff |
last post by:
Hey
asp.net 2.0
In the source I posted below, there is a GridView (look at the bottom of the
script):
<asp:GridView ID="gvwOnline" runat="server">
</asp:GridView>
I'm trying to assign a datasource to this GridView in runtime. But I cannot
|
by: castironpi |
last post by:
I'm curious about some of the details of the internals of the Python
interpreter:
I understand C from a hardware perspective.
x= y+ 1;
Move value from place y into a register
Add 1 to the value in the register
Move the addition's result to place x
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |