protected void btnDel_Click(object sender, EventArgs e) { LinkButton lbt = sender as LinkButton; rowid_mst = Convert.ToInt16(lbt.Attributes["rowid_mst"].ToString()) - (int.Parse(TextBoxPagesize.Text) * GridView1.PageIndex); if (GridView1.Rows[rowid_mst].Cells[0].Text != "未結轉") { ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR021.aspx", "alert(' 已結轉表單不可刪除! ');", true); } else { //抓取本頁初次登記的時間 string SessionIDName = "VGR021_" + PageTimeStamp.Value; DataTable Dt = (DataTable)Session[SessionIDName]; //int result; //string strID = GridView1.Rows[rowid_mst].Cells[1].Text; string strID = ((Label)GridView1.Rows[rowid_mst].FindControl("Label9")).Text; //VGRModel.MaintainChanReturnData BCO = new PIC.VDS2G.LGT.VGR.MaintainChanReturnData(ConntionDB); //ParameterList.Clear(); //ParameterList.Add(strID); ////ParameterList.Add(); ////ParameterList.Add(); ////ParameterList.Add(); ////ParameterList.Add(); ////db.AddInParameter(cmd, "V_OLD_BATCH_NO", DbType.String, ParameterList[0]); ////db.AddInParameter(cmd, "V_OLD_CREATEUID", DbType.String, ParameterList[1]); ////db.AddInParameter(cmd, "D_OLD_CREATEDATE", DbType.Date, ParameterList[2]); ////db.AddInParameter(cmd, "V_OLD_UPDATEUID", DbType.String, ParameterList[3]); ////db.AddInParameter(cmd, "D_OLD_UPDATEDATE", DbType.Date, ParameterList[4]); //ArrayList ParameterList2 = new ArrayList(); ////ParameterList2.Add(); //BCO.doDelete(ParameterList, ParameterList2, DBT); //============================================================================================= VGRModel.MaintainChanReturnData BCO = new PIC.VDS2G.LGT.VGR.MaintainChanReturnData(ConntionDB); string strBatchNo = GridView1.Rows[rowid_mst].Cells[1].Text; BCO.doDelete(strBatchNo, DBT); databind(); //============================================================================================= //DataRow dr = Dt.Select("ID = " + strID)[0]; //dr.Delete(); //GridView1.DataSource = Dt; //GridView1.DataBind(); } }
//刪除鈕 protected void btnDel_Click(object sender, EventArgs e) { try { if (ckbStatus.Checked) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGR022.aspx", "alert(' 此表單已結轉不可刪除! ');", true); } else { VGRModel.MaintainChanReturnData BCO = new PIC.VDS2G.LGT.VGR.MaintainChanReturnData(ConntionDB); BCO.doDelete(this.txtBatchNo.Text, DBT); Response.Redirect(string.Format("VGR021.aspx?Code=VGR02")); } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }