.NET同一页面 用户控件调用父页面方法与控件之间的方法调用
1、用户控件调用父页面方法
//获得父页面
Page p =this.Parent.Page;
Type pageType = p.GetType();
//父页面的方法名
MethodInfo mi = pageType.GetMethod("SaveBill");
//执行
mi.Invoke(p,null);
2、控件之间调用
//获得父页面
Page p =this.Parent.Page;
//获得父页面的子控件
UserControl uc = p.FindControl("hidTag") as UserControl;
Type pageType = uc.GetType();
//父页面的方法名
MethodInfo mi = pageType.GetMethod("SaveBill");
//执行
mi.Invoke(p,null);