public void TextFurnacesName_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TextFurnacesName.Text)) { alert_box.Visible = false; OracleConnection conn = new OracleConnection(strConnString); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select * from MF_PRODUCTION_FURNACES where FURNACES_NAME = '" + TextFurnacesName.Text + "'"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { CheckFurnacesName.Text = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Furnaces name is already entry</label>"; CheckFurnacesName.ForeColor = System.Drawing.Color.Red; TextFurnacesName.Focus(); BtnAdd.Attributes.Add("aria-disabled", "false"); BtnAdd.Attributes.Add("class", "btn btn-primary disabled"); } else { CheckFurnacesName.Text = "<label class='control-label'><i class='fa fa fa-check'></i> Furnaces name is available</label>"; CheckFurnacesName.ForeColor = System.Drawing.Color.Green; TextDescription.Focus(); BtnAdd.Attributes.Add("aria-disabled", "true"); BtnAdd.Attributes.Add("class", "btn btn-primary active"); } } else { CheckFurnacesName.Text = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Furnaces name is not blank</label>"; CheckFurnacesName.ForeColor = System.Drawing.Color.Red; TextFurnacesName.Focus(); } }