title: Disable textboxes based on radio button selection
body: <p>I have three radio buttons and five text boxes in my web page. I want to disable text boxes based on the radio box selection. This code is working fine but when I check a different radio button the previous gray textbox is not turning white. Please correct me I have tried several ways it did not work. </p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
      {
              if (!IsPostBack)
          {
              txtName.Enabled = false;
              txtTitle.Enabled = false;
              txtOrganization.Enabled = false;
              txtPhone.Enabled = false;
              txtEmail.Enabled = false;
  
          }
          if (rdPhone.Checked == true)
          {
              txtName.Enabled = true;
              txtName.Focus();
              txtTitle.Enabled = true;
              txtOrganization.Enabled = true;
              txtPhone.Enabled = true;
              txtEmail.Enabled = false;
              txtEmail.BackColor = System.Drawing.Color.LightGray;
          }
          if (rdEmail.Checked == true)
          {
              txtName.Enabled = true;
              txtName.Focus();
              txtTitle.Enabled = true;
              txtOrganization.Enabled = true;
              txtPhone.Enabled = false;
              txtPhone.BackColor = System.Drawing.Color.LightGray;
              txtEmail.Enabled = true;
          }
  
          if (rdDoNotContact.Checked == true)
          {
              txtName.Enabled = false;
              txtName.BackColor = System.Drawing.Color.LightGray;
              txtTitle.Enabled = false;
              txtTitle.BackColor = System.Drawing.Color.LightGray;
              txtOrganization.Enabled = false;
              txtOrganization.BackColor = System.Drawing.Color.LightGray;
              txtPhone.Enabled = false;
              txtPhone.BackColor = System.Drawing.Color.LightGray;
              txtEmail.Enabled = false;
              txtEmail.BackColor = System.Drawing.Color.LightGray;
  
          }
      }
  </code></pre>