private void updatecode() { try { if (hd.Value != "true") { if (hde.Value != "true") { Label1.Text = string.Empty; lblcheckDoubleError.Text = String.Empty; GridViewRow row = GridView1.SelectedRow; int product_id = Convert.ToInt32(ViewState["tax_id"]); decimal sales_price = decimal.Parse(txtSalesPrice.Text); decimal purchase_price = decimal.Parse(txtPurchasePrice.Text); int cat_id = Int32.Parse(ddlCategory.SelectedValue); int unit_id = Int32.Parse(ddlUnit.SelectedValue); int godown_id = Int32.Parse(ddlGodown.SelectedValue); int rack_id = Int32.Parse(ddlRack.SelectedValue); int tax_id = Int32.Parse(ddlTax.SelectedValue); int orderlevel = Convert.ToInt32(txtReorderqty.Text); context.sp_UpdateProduct(companyId, branchId, product_id, cat_id, rack_id, godown_id, tax_id, unit_id, orderlevel, purchase_price, sales_price, txtProductCode.Text, txtHSNCode.Text, txtProductName.Text, User_id, DateTime.Today); btnUpdate.Visible = false; btnSave.Visible = true; divalert.Visible = true; clr(); loadDataTable(); lblAlert.Text = "Product Updated Successfully "; } else { divalert.Visible = false; lblcheckDoubleError.ForeColor = System.Drawing.Color.Red; lblcheckDoubleError.Text = "This Product Code name already Exists"; } } else { divalert.Visible = false; Label1.ForeColor = System.Drawing.Color.Red; Label1.Text = "This Product Name already Exists"; } } catch (Exception ex) { ErrorLog.saveerror(ex); //Do Logging } }