0
我創建了一個包含多個動態按鈕的儀表板。當我點擊「刪除」按鈕時,我想要執行服務器端代碼。我已將代碼添加到我的按鈕的Click事件處理程序中。執行一個動態的asp按鈕單擊事件
動態按鈕與下面的代碼創建:
Button PopupDeleteButton = new Button();
PopupDeleteButton.ID = "PBD" + controlValue.ID.ToString();
PopupDeleteButton.Text = "Delete";
PopupDeleteButton.Style["Height"] = "15px";
PopupDeleteButton.Style["Width"] = "50px";
PopupDeleteButton.Style["top"] = "0";
PopupDeleteButton.Style["right"] = "0";
PopupDeleteButton.Style["float"] = "left";
PopupDeleteButton.Style["font-size"] = "9px";
PopupDeleteButton.Style.Add(HtmlTextWriterStyle.VerticalAlign, "top");
PopupDeleteButton.Attributes.Add("runat","server");
PopupDeleteButton.Click += new EventHandler(this.RemoveWidgetFromXML_Click);
然而,當我點擊一個回發生在窗體上的動態按鈕,功能RemoveWidgetFromXML永遠不會被調用。有任何想法嗎?我已經看遍了谷歌,但無法找到如何阻止事件發生之前發生的回傳。