private void updatelogic() { try { if (hde.Value != "true") { lblcheckDoubleError.Text = String.Empty; int expense_id = Convert.ToInt32(ViewState["expense_id"]); context.sp_UpdateExpense(companyId, branchId, expense_id, txtExpenseName.Text, User_id, DateTime.Today); btnUpdate.Visible = false; btnSave.Visible = true; txtExpenseName.Text = string.Empty; divalert.Visible = true; lblAlert.Text = "Expense Updated Successfully "; loadDataTable(); } else { divalert.Visible = false; lblcheckDoubleError.ForeColor = System.Drawing.Color.Red; lblcheckDoubleError.Text = "Expense Name is already exists "; } } catch (Exception ex) { ErrorLog.saveerror(ex); //Do Logging } }