2014年11月12日 星期三

ASP.NET C# Call Button1_Click(呼叫Button2_Click)

ASP.NET C# Call Button1_Click(呼叫Button2_Click)

C#:
// No "sender" or event args
public void Button2_Click(object sender, EventArgs e)
{
   button1_click(null, null);
}
// Button2's the sender and event args
public void Button2_Click(object sender, EventArgs e)
{  
   Button1_Click(sender, e);
}
// Button1's the sender and Button2's event args
public void Button2_Click(object sender, EventArgs e)
{  
   Button1_Click(this.Button1, e);
}

http://stackoverflow.com/questions/2152429/how-do-i-call-an-event-method-in-c

沒有留言:

張貼留言