0

程序如何捕获生成来自asp.net 中动态创建的按钮控件的事件?

4

2 回答 2

3

您可以以编程方式附加事件:

Button myButton = new Button();
myButton.Click += new ClickEventHandler...etc
于 2008-12-06T05:40:05.980 回答
0

按钮 ButtonDeleteFromDB = new Button();

ButtonDeleteFromDB.Text = "删除";

ButtonDeleteFromDB.ID = "btnDeleteFromDB" + ctrlCount.ToString();

ButtonDeleteFromDB.Click += new EventHandler(ButtonDeleteFromDB_Click);

以下列方式调用事件:

私人无效ButtonDeleteFromDB_Click(对象发送者,EventArgs e){}

于 2008-12-08T06:09:56.573 回答