2014年11月12日 星期三

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

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

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

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

沒有留言:

張貼留言