Sunday, 16 November 2014

Calling A Button OnClick from a function

Suppose you have a function test() and button. You want to call button click event from function automatically, you can do as:

private void ExtractedMethod()
{ 
 //some list of code
Button_Click(null, EventArgs.Empty);
}
protected void Button_Click(object sender, EventArgs e)
 {
  //some list of code     }

No comments:

Post a Comment