title: how to enable/disable dropdownlist by javascript in asp.net
body: <p>I have simple code that is a dropdown list and Two buttons (named enable and disable)i want to enable and disable the dropdown list by javascript function and after button click 
  asp.net HTML code:</p>
  
  <pre><code>    &lt;asp:DropDownList ID="DropDownList1" runat="server"&gt;
          &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;4&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;5&lt;/asp:ListItem&gt;
      &lt;/asp:DropDownList&gt;
      &lt;br /&gt;
      &lt;asp:DropDownList ID="DropDownList2" runat="server"&gt;
          &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;4&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;5&lt;/asp:ListItem&gt;
      &lt;/asp:DropDownList&gt;
  
      &lt;asp:Button ID="Button1" runat="server" OnClientClick="return enable();" Text="enable" /&gt;
      &lt;asp:Button ID="Button2" runat="server" OnClientClick="return disable2();" Text="disable" /&gt;
  </code></pre>
  
  <p>javascript function :</p>
  
  <pre><code>function enable() {
  
              document.getElementById("DropDownList1").disabled = false;
              document.getElementById("DropDownList2").disabled = false;
              return;
          }
  
        function disable() {
  
       document.getElementById("DropDownList1").disabled = true;
       document.getElementById("DropDownList2").disabled = true;
  
        }
  
  and pageloadlogic:public partial class _Default : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
  
       }
  }
  </code></pre>
  
  <p>but i tried this many times and not getting the expected output please let me known the solution</p>