Here are both pageload and selecteditemchanged...when I load the page,
it let's me select the Customer (control 1), and DOES filter the second
control, but at the same time, resets control 1 to "Select
Customer"...ugh.
Both controls set to autopostback and enable viewstate.
Any ideas?
Thanks.
KathyBurke
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
Dim Conn1 As OleDbConnection
Dim Rdr1 As OleDbDataReader
Dim Cmd1 As OleDbCommand
Dim strSQL As String
Conn1 = New OleDbConnection(strConn)
strSQL = "SELECT DISTINCT Customer FROM tblCustomers ORDER
BY Customer"
Cmd1 = New OleDbCommand(strSQL, Conn1)
Conn1.Open()
Rdr1 = Cmd1.ExecuteReader()
cboCust.DataSource = Rdr1
cboCust.DataBind()
cboCust.Items.Insert(0, "Select Customer")
cboCust.SelectedIndex = 0
Rdr1.Close()
Conn1.Close()
End If
End Sub
Private Sub cboCust_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboCust.SelectedIndexChanged
Dim Conn2 As New OleDbConnection()
Dim Rdr2 As OleDbDataReader
Dim strSQL2 As String = "SELECT Assy FROM tblAssy WHERE
([Customer] =
@customer) ORDER BY Assy"
Dim Cmd2 As New OleDbCommand(strSQL2, Conn2)
Conn2 = New OleDbConnection(strConn)
Dim prmCustomer As OleDbParameter = New
OleDbParameter("
@customer", OleDbType.VarChar, 50)
prmCustomer.Value = cboCust.SelectedItem.Value
Cmd2.Parameters.Add(prmCustomer)
Cmd2.Connection = Conn2
Conn2.Open()
Rdr2 = Cmd2.ExecuteReader()
cboAssy.DataSource = Rdr2
cboAssy.DataBind()
cboAssy.Items.Insert(0, "Select Assembly")
cboCust.SelectedIndex = 0
Rdr2.Close()
Conn2.Close()
End Sub