1
我有一個表單,它搜索在日期範圍內發生的單個表(TServices)中的所有行,然後在表單下面填充動態表。動態表數據在ImageButton上消失點擊
現在我在表中的每個列表旁邊添加一個刪除ImageButton。這裏是我的C#代碼隱藏添加ImageButtons表格單元格:
ImageButton btnRemoveService = new ImageButton();
btnRemoveService.EnableViewState = true;
btnRemoveService.ImageUrl = "/images/icons/trash.gif";
btnRemoveService.Click += new ImageClickEventHandler(btnRemoveService_Click);
btnRemoveService.ID = "btnRemoveService-" + row["BillingID"].ToString();
btnRemoveService.CommandArgument = row["BillingID"].ToString();
tblCell.Controls.Add(btnRemoveService);
即使我把沒有在btnRemoveService_Click(),從動態表我的所有數據消失。當我放入代碼以實際刪除存儲過程時,數據從動態表中消失,並且數據庫中沒有任何更改。
編輯: 我將填充代碼移到它自己的函數中,並在btnRemoveService_Click()的末尾調用它。不應該重新加載數據?