private void updatelogic() { try { if (hde.Value != "true") { lblcheckDoubleError.Text = String.Empty; int a = Convert.ToInt32(ddlState.SelectedValue); int party_id = Convert.ToInt32(ViewState["party_id"]); context.sp_UpdateParty(companyId, branchId, party_id, a, txtPartyName.Text, txtPartyAddress.Text, txtContactNo.Text, ddlPartyType.SelectedItem.Text, txtGSTIN.Text, User_id, DateTime.Today); btnUpdate.Visible = false; btnSave.Visible = true; divalert.Visible = true; lblAlert.Text = "Party Updated Successfully "; CLR(); loadDataTable(); } else { divalert.Visible = false; lblcheckDoubleError.ForeColor = System.Drawing.Color.Red; lblcheckDoubleError.Text = "Party Name is already exists "; } } catch (Exception ex) { ErrorLog.saveerror(ex); //Do Logging } }