答案 0 :(得分:2)
将您的函数声明为事件:
protected void YourButtonClickEvent(object sender, EventArgs e)
{
// To hide your button
Button button = sender as Button;
button.visible = false;
// Your code
}
声明您的按钮并为其添加事件
Button button = new Button();
button.Click += new EventHandler(YourButtonClickEvent);