public partial class WebUserControl : System.Web.UI.UserControl{public void TestMethod(string strID){ this.TextBox1.Text += " WebUserControl:" + strID; } public partial class WebUserControl2 : System.Web.UI.UserControl{ public void TestMethod(string strID){ this.TextBox1.Text += " WebUserControl2:" + strID; } public partial class Default1 : System.Web.UI.Page{bool isShow = true;string strWebUserControls = "WebUserControl,WebUserControl2";protected void Page_Load(object sender, EventArgs e){if (isShow){ string[] strUCs = strWebUserControls.Split(","); for (int i = 0; i < strUCs.Length; i++) { string strUCName = strUCs[i].ToString(); Control a = Page.LoadControl(strUCName+".ascx"); a.ID = strUCName; this.Panel1.Controls.Add(a); } } } protected void Button1_Click(object sender, EventArgs e) { if (isShow) { string[] strUCs = strWebUserControls.Split(","); for (int i = 0; i < strUCs.Length; i++) { string strUCName = strUCs[i].ToString(); Type tc = this.Panel1.FindControl(strUCName).GetType(); Control uc = this.Panel1.FindControl(strUCName); ////object o = System.Activator.CreateInstance(uc.GetType()); System.Reflection.MethodInfo m = tc.GetMethod("TestMethod"); object[] bjParas = new object[1]; objParas[0] = "1"; m.Invoke(uc, objParas); ////m.Invoke(a, null); } } }