title: c# hide Label on empty Textbox
body: <p>I am willing to hide the label on empty Text &lt;-- this is my Expected output(Just pointing to make sure you understand what i am willing to be solved with the help from my pro-programmers here :P), i have enabled <code>AutoPostBack</code> and an created an event <code>OnTextChanged</code> and i defined the following code in it. But it seems to not working. Any ideas?</p>
  
  <pre><code>protected void TextBox_signup_loginid_TextChanged(object sender, EventArgs e)
  {
      if (TextBox_signup_loginid.Text == "")
      {
          Label_signup_loginidcheck.Visible = false;
      }
      int found = 0;
      using (SqlConnection con = new SqlConnection(cs))
      {
          string query = "select count(*) from Users where LoginId = '" + TextBox_signup_loginid.Text + "'";
          SqlCommand cmd = new SqlCommand(query, con);
          con.Open();
          found = Convert.ToInt32(cmd.ExecuteScalar().ToString());
          if (found == 1)
          {
              Label_signup_loginidcheck.ForeColor = System.Drawing.Color.Red;
              Label_signup_loginidcheck.Text = "LoginId Already Exists";
              Label_signup_loginidcheck.Visible = true;
              hdf.Value = "false";
          }
          else
          {
              Label_signup_loginidcheck.Visible = true;
              Label_signup_loginidcheck.ForeColor = System.Drawing.Color.Green;
              Label_signup_loginidcheck.Text = "LoginId Available";
              hdf.Value = "true";
          }
      }
  </code></pre>