title: Add values to dropdown list programatically at run time
body: <p>I am trying to change the list item values of a dropdown list based on values of an other dropdown list. The list values of drpAdult range from 0-9 and list values of drpInfant range from 0-(Value of drpAdult selected).</p>
  
  <p>So, for example, if I select 5 in the drpAdult dropdown, the range of list item values of drpInfant will be from 0-5.</p>
  
  <p>I have written the code below, but it is not populating the values in the drpInfant dropdown, which I am trying to insert on drpAdult_SelectedIndexChanged event.</p>
  
  <pre><code>Protected Sub drpAdult_SelectedIndexChanged(ByVal sender As Object, 
   ByVal e As EventArgs) Handles drpAdult.SelectedIndexChanged  
  
      Dim count As Integer    
      count = drpAdult.Items.Count
      Dim i As Integer
      i = 0
       While count &gt; 0
          i = i + 1
  
          drpInfant.Items.Add(New ListItem(i, i))
          count = count - 1
  
      End While
  End Sub
  </code></pre>
  
  <p>What might cause this problem, and how can I resolve it?</p>