protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string strMessage = string.Empty; string strCheck = string.Empty; string strScript = string.Empty; string strUpdatedBy = Session["username"].ToString(); Label lblfund_code = (Label)GridView1.Rows[e.RowIndex].FindControl("lblfund_code"); cFund oFund = new cFund(); try { if (!oFund.SP_DEL_FUND(lblfund_code.Text, "N", strUpdatedBy, ref strMessage)) { lblError.Text = strMessage; } } catch (Exception ex) { if (ex.Message.Contains("REFERENCE constraint")) { MsgBox("ไม่สามารถลบข้อมูลได้เนื่องจากมีการนำไปใช้ในระบบแล้ว"); } else { lblError.Text = ex.Message.ToString(); } } finally { oFund.Dispose(); } BindGridView(0); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string strMessage = string.Empty; string strCheck = string.Empty; string strScript = string.Empty; string strUpdatedBy = Session["username"].ToString(); Label lblfund_code = (Label)GridView1.Rows[e.RowIndex].FindControl("lblfund_code"); cFund oFund = new cFund(); try { if (!oFund.SP_DEL_FUND(lblfund_code.Text, "N", strUpdatedBy, ref strMessage)) { lblError.Text = strMessage; } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { oFund.Dispose(); } BindGridView(0); }