title: ASP.NET Populate a dropdownlist based on the changed event in another dropdown
body: <p>I want to populate the dropdownlist ddVerantwortlich1 with the people with the proper credentials based on the selected process step  ddProzessschritt1</p>
  
  <p>It doesn't work if I want to change it using datasource and databind
  i have to manually loop through the table in the dataset returned from the query. then it works. but not otherwise...</p>
  
  <p>What's the problem? Here my code:</p>
  
  <pre><code>Protected Sub ddProzessschritt1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddProzessschritt1.SelectedIndexChanged
      'StefanSteiger.Debug.MsgBox("index changed!")
  
      Dim dsProcessResponsibleDataSet As Data.DataSet = New DataSet
      Dim strSQL As String = "SELECT BE_ID, (BE_Name + ' ' +BE_Vorname) as UserName FROM T_Benutzer WHERE BE_ID IN "
      strSQL += "(SELECT BEBG_BE FROM T_Benutzer_Benutzergruppen WHERE BEBG_BG IN "
      strSQL += "(SELECT ZO_BG_ID FROM T_DMS_ZO_Prozesse_Berechtigungen WHERE ZO_PROC_UID = '" + ddProzessschritt1.SelectedValue.ToString + "')) ORDER BY UserName"
  
      If StefanSteiger.DBcmds.GetDataSet(strSQL, dsProcessResponsibleDataSet) &gt; 0 Then
          Me.ddVerantwortlich1.Items.Clear()
          For Each row As Data.DataRow In dsProcessResponsibleDataSet.Tables(0).Rows
              'StefanSteiger.Debug.MsgBox(row("UserName").ToString + " ¦ " + row("BE_ID").ToString)
              ddVerantwortlich1.Items.Add(New ListItem(row("UserName"), row("BE_ID")))
          Next
          'Me.ddVerantwortlich1.Dispose()
          'Me.ddProzessschritt1.DataSource = dsProcessResponsibleDataSet.Tables(0)
          'Me.ddVerantwortlich1.DataTextField = "UserName"
          'Me.ddVerantwortlich1.DataValueField = "BE_ID"
          'Me.ddVerantwortlich1.DataBind()
      Else
          'Me.ddProzessschritt1.Dispose()
          ddVerantwortlich1.Items.Add(New ListItem("Niemand verantwortlich.", Nothing))
      End If
  End Sub
  </code></pre>