用反射就可以解决,具体自己研究,这是我以前写的,现在都忘光了,可能代码中有误
protected void www()
{
TextBox1.Text = "www被触发";
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//
Type t = Type.GetType(Convert.ToString(this));//
反射无参数
//
MethodInfo method = t.GetMethod("www", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { }, null);
//
method.Invoke(this,null);
Type t = Type.GetType(Convert.ToString(this));//
反射有参数
MethodInfo method = t.GetMethod("Button2_Click", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(object), typeof(EventArgs) }, null);
method.Invoke(this,new Object[2]{sender,e});
// Object[] o=new Object[2]{sender,e};method.Invoke(this,o);
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "button2被触发";
}