calling a function in a page

Hi,

first of all you have to think about if this is really useful!
What happens if the function is missing? Why to develope a control if you have to insert a function into each pare you want to use the control?

Maybe you have to insert the function into your UserControl?

But if you still want to do:
See about System.Reflection! I have written some class to set public variables in my page and I'll think, methods can be called with this feature too.

System.Reflection.MethodInfo mi = Page.GetType().GetMethod("YourMethod");

mi.[doSomething]

Regards, Stefan
 
wessamzeidan said:
Hi, how can I call a function in a page from a dynamicaly loaded usercontrol...
Is this a user defined function???

make an interface IMyInterface with a method, MyMethod. . .
add that interface to the page containing the control and define MyMethod to do what you want. . .

in the user control try casting the user control's page to an IMyInterface, if it succeeds, call the method. . .

done
 
Back
Top