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.reflection 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.Reflection.MethodInf
mi = Page.GetType.GetMethod("PageFunction"
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 IPublicPageForUse
...
IA GetAObject()
public MyPage : Page, IPublicPageForUse
public IA GetAObject(
A aObj = new A()
return (IA)aObj
the user control retrieve the object A with
IA aObj = ((IPublicPageForUser)this.Page).GetAObject(
aObj.Pippo()
I hope that my example is clear and good for your work
Bru
"Earl Teigrob" <ea******@hotmail.com> wrote in messag
news:ey**************@TK2MSFTNGP12.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