In a user control, gets the method of the parent page
1: Method has no parameters (Userinfor ())
String userinfor = Convert.ToString (This. Page.gettype (). GetMethod ("Userinfor"). Invoke (this. Page, null)); The value obtained is the type of object
2: Method has parameters (userinfor (int a,string b))
String userinfor = Convert.ToString (This. Page.gettype (). GetMethod ("Userinfor"). Invoke (this. Page, new Object[] { " parameter 1"," parameter 2" } ));
Call between the user control and the user control:
Gets the parent page, p = this. Parent.page; Gets the child control of the parent page UserControl UC = P.findcontrol ("Tj_receiptlist2") as UserControl; Type PageType = UC. GetType ();//Parent class method name MethodInfo mi = Pagetype.getmethod ("Loading");//parameter mi. Invoke (UC, new object[] {"Parameter 1", "Parameter 2"});
Attention:
The method that is called by the parent page or other user control must be public!
Reprinted blog: http://www.cnblogs.com/over140/archive/2008/06/16/1222908.html
Asp. NET in-page "user Control and parent page" and "User control and user control" method calls