protected void lvDataList_ItemCommand(object sender, ListViewCommandEventArgs e) { //取得Key值 string Get_DataID = ((HiddenField)e.Item.FindControl("hf_DataID")).Value; //----- 宣告:資料參數 ----- SignDataRepository _data = new SignDataRepository(); try { //----- 方法:刪除資料 ----- if (false == _data.Delete(Get_DataID, out ErrMsg)) { CustomExtension.AlertMsg("刪除失敗", thisPage); return; } else { //導向本頁 Response.Redirect(thisPage); } } catch (Exception) { throw; } finally { _data = null; } }