title: Checkbox activates textboxes in asp.net with vb.net
body: <p>I am creating a page in asp.net with vb.net and I have a check box that I would like to use to activate four text boxes and a drop down list.  I have tried using JavaScript to get this working, but it isn't working so far.  I have tried just activating one text box at this point.  Any suggestions?</p>
  
  <p>Here are my different objects:</p>
  
  <ul>
  <li>cbPractitioner (check box)</li>
  <li>txtNPI (text box)</li>
  <li>txtLicense (text box)</li>
  <li>txtDEA (text box)</li>
  <li>txtUpin (text box)</li>
  <li>ddSpecialty (drop down list)</li>
  </ul>
  
  <p>Here is the Javascript code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function ToggleTextBox(cbPractitioner, txtNPI) {
          var textbox = document.getElementById(txtNPI);
          if (cbPractitioner.checked) {
              txtNPI.disabled = false;
              txtNPI.value = "";
          }
          else {
              txtNPI.disabled = true;
              txtNPI.value = "";
          }
      }
   &lt;/script&gt;
  </code></pre>
  
  <p>Here is the asp.net code:</p>
  
  <pre><code>&lt;asp:CheckBox ID="cbPractitioner" runat="server" 
                  text="This person is a Practitioner" 
                  style="font-family: Arial, Helvetica, sans-serif; font-size: small" 
                  onclick="ToggleTextBox(this,'txtNPI')" /&gt;
  &lt;asp:Label ID="lblNPI" runat="server" CssClass="style9" Text="NPI:"&gt;&lt;/asp:Label&gt;
  
              &amp;nbsp;
  
              &lt;asp:TextBox ID="txtNPI" runat="server" Width="165px" style="text align:left" CssClass="style9" 
                      Font-Names="Arial" Font-Size="Small" Enabled="false"&gt;&lt;/asp:TextBox&gt;
  
              &lt;br /&gt;
              &lt;br /&gt;
              &lt;asp:Label ID="lblDEA" runat="server" CssClass="style9" Text="DEA Number:"&gt;    &lt;/asp:Label&gt;
              &amp;nbsp;
              &lt;asp:TextBox ID="txtDEA" runat="server" style="text-align:left" Font-Names="Arial" 
                      Font-Size="Small" Enabled="false"&gt;&lt;/asp:TextBox&gt;
              &lt;br /&gt;
              &lt;br /&gt;
              &lt;span class="style9"&gt;
  
              &lt;/span&gt;
  
          &lt;/td&gt;
          &lt;td class="style14" valign="top"&gt;
  
              &lt;asp:Label ID="lblLicense" runat="server" CssClass="style9" 
                  Text="License Number:"&gt;&lt;/asp:Label&gt;
              &amp;nbsp;
              &lt;asp:TextBox ID="txtLicense" runat="server" Font-Names="Arial"  style="text-align:left"
                      Font-Size="Small" Height="20px" Enabled="false"&gt;&lt;/asp:TextBox&gt;
              &lt;br /&gt;
              &lt;br /&gt;
              &lt;span class="style9"&gt;
              &lt;asp:Label ID="Upin" runat="server" Text="Upin:"&gt;&lt;/asp:Label&gt;
              &amp;nbsp;
              &lt;/span&gt;
  
              &lt;asp:TextBox ID="txtUpin" runat="server" Width="173px" CssClass="style9" style="text-align:left"
                      Font-Names="Arial" Font-Size="Small" Enabled="false"&gt;&lt;/asp:TextBox&gt;
  
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td colspan="2"&gt;
              &lt;asp:Label ID="lblSpecialty" runat="server" 
                  style="font-family: Arial, Helvetica, sans-serif; font-size: small" 
                  Text="Specialty:"&gt;&lt;/asp:Label&gt;
              &lt;asp:DropDownList ID="ddSpecialty" runat="server" 
                  DataSourceID="Practitioner_Specialty" DataTextField="SPEC_TITLE" 
                  DataValueField="SPEC_TITLE" Enabled="false"&gt;
              &lt;/asp:DropDownList&gt;
  </code></pre>