title: How to change the text color of disabled Asp.net DropDownList
body: <p>I searched for some time on this question and couldn't find a working answer anywhere. </p>
  
  <p>I have an asp DropDownList that gets disabled and enabled based on whether the form is in view mode or not. The problem I was having is when the DropDownList.Enabled = false the text is hard to read(grey on lightgrey).</p>
  
  <p>I solved the issue by passing the DropDownList to some methods.</p>
  
  <pre><code>public void DisableDDL(ref DropDownList DDL)
  {
      DDL.BackColor = System.Drawing.Color.LightGray;
      foreach (ListItem i in DDL.Items)
      {
          if (i != DDL.SelectedItem)
          {
              i.Enabled = false;
          }
      }
  }
  
  public void EnableDDL(ref DropDownList DDL)
  {
      DDL.BackColor = System.Drawing.Color.White;
      foreach (ListItem i in DDL.Items)
      {
          i.Enabled = true;                        
      }
  }
  </code></pre>
  
  <p>Is there another way to do this?
  I tried using css but that didn't work.</p>
  
  <pre><code>&lt;style&gt;
  .disabledStyle
  {
      color: black;        
  }
  &lt;/style&gt;
  
  myDDl.CssClass = "disabledStyle";
  </code></pre>