foreach(Button B in Button[]) { B.Click += new System.EventHandler(this.B_Login_Click); if(B.CommandArgument=="測試") { //自行添加處理的代碼 } }
foreach(Button B in new Button[]{this.B_Login,this.Button1}) { B.Click += new System.EventHandler(this.B_Login_Click); if(B.CommandArgument=="測試") { //自行添加處理的代碼 } }
类似 this.cmd_Sort.Click += new System.EventHandler(this.cmd_Sort_Click); this.cmd_Random.Click += new System.EventHandler(this.cmd_Random_Click); this.DataGrid1.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_DeleteCommand);
{
B.Click += new System.EventHandler(this.B_Login_Click);
if(B.CommandArgument=="測試")
{
//自行添加處理的代碼
}
}
{
B.Click += new System.EventHandler(this.B_Login_Click);
if(B.CommandArgument=="測試")
{
//自行添加處理的代碼
}
}
this.cmd_Sort.Click += new System.EventHandler(this.cmd_Sort_Click);
this.cmd_Random.Click += new System.EventHandler(this.cmd_Random_Click);
this.DataGrid1.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_DeleteCommand);
这样
你肯定有MSDN的,赶紧补回来哦~~~