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 lblbudget_money_doc = (Label)GridView1.Rows[e.RowIndex].FindControl("lblbudget_money_doc"); cBudget_money oBudget_money = new cBudget_money(); try { oBudget_money.SP_BUDGET_MONEY_HEAD_DEL(lblbudget_money_doc.Text); } catch (Exception ex) { if (ex.Message.Contains("REFERENCE constraint")) { MsgBox("ไม่สามารถลบข้อมูลได้เนื่องจากมีการนำไปใช้ในระบบแล้ว"); } else { lblError.Text = ex.Message.ToString(); } } finally { oBudget_money.Dispose(); } BindGridView(0); }