Hey Guys,
I have 2 dropdown lists in a datalist that are populated when you enter into edit mode. I was wondering how to changed the second dropdownlist's datasource when the first one's OnSelectedIndexChanged event is fired.

I put this code in the first dropdownlist
VB Code:
  1. OnSelectedIndexChanged=SelectionChanged

and this in the codebehind:

VB Code:
  1. Sub SelectionChanged(ByVal sender As Object, _
  2.                        ByVal e As DataListCommandEventArgs)
  3.         Dim strCategoryID As String
  4.         Dim subcat As DropDownList
  5.  
  6.         strCategoryID = CType(e.Item.FindControl("Category1"), _
  7.                                   DropDownList).SelectedItem.Value
  8.  
  9.         Dim objConnection As OleDbConnection
  10.         Dim objCommand As OleDbCommand
  11.         Dim strSQLQuery As String
  12.         Dim groupid As OleDbDataReader
  13.  
  14.  
  15.  
  16.         objConnection = New OleDbConnection(ConfigurationSettings.AppSettings("ConnectionString"))
  17.  
  18.  
  19.  
  20.         strSQLQuery = "Select * from subgroupsingroups where idGroup=" & CInt(strCategoryID)
  21.         objConnection.Open()
  22.  
  23.  
  24.  
  25.         objCommand = New OleDbCommand(strSQLQuery, objConnection)
  26.  
  27.         groupid = objCommand.ExecuteReader()
  28.  
  29.  
  30.         objConnection.Close()
  31.  
  32.         subcat = e.Item.FindControl("Category2")
  33.         subcat.DataSource = groupid
  34.         subcat.DataBind()
  35.  
  36.  
  37.     End Sub

I need to figure out how to pass the two arguments(Byval sender As Object, ByVal e As DataListCommandEventArgs) from the dropdownlist to the Sub SelectionChanged.

Any ideas???

Thanks,
Bebandit