public void Updatelogic() { try { if (hd.Value != "true") { lblcheckDoubleError.Text = String.Empty; int a = Convert.ToInt32(Session["company_id"]); int bf = Int32.Parse(ddlcountry.SelectedValue); int c = Int32.Parse(ddlState.SelectedValue); string name = Convert.ToString(Session["username"]); int b = Convert.ToInt32(ViewState["branchid"]); context.sp_UpdateBranch(b, a, txtBranchName.Text, txtAddress.Text, txtpincode.Text, txttelephoneno.Text, txtFaxno.Text, bf, c, txtCity.Text, name); btnUpdate.Visible = false; btnSave.Visible = true; divalert.Visible = true; lblAlert.Text = "Branch Updated Successfully "; clr(); grdbind(); } else { divalert.Visible = false; lblcheckDoubleError.ForeColor = System.Drawing.Color.Red; lblcheckDoubleError.Text = "This Branch name is already Exists"; return; } } catch (Exception ex) { ErrorLog.saveerror(ex); } }