protected void btnYes_Click(object sender, EventArgs e) { try { int unit_ID = Convert.ToInt32(ViewState["unit_id"]); context.sp_DeleteUnit(companyId, branchId, unit_ID); } catch (Exception ex) { ErrorLog.saveerror(ex); //Do Logging } }