protected void gvServiceDocket_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "D") { string serviceBookId = e.CommandArgument.ToString(); Entity.Service.CsrJson csrJson = new Entity.Service.CsrJson(); Business.Service.ServiceBook objServiceBook = new Business.Service.ServiceBook(); DataTable dtCsr = objServiceBook.Service_CsrGetByServiceBookId(Convert.ToInt64(serviceBookId)); int response = objServiceBook.Service_CsrDelete(Convert.ToInt64(dtCsr.Rows[0]["CsrId"].ToString())); if (response > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Existing csr deleted.');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Csr can not be deleted!!!....');", true); } } } catch (Exception ex) { ex.WriteException(); } }