Here are both pageload and selecteditemcha nged...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.EventArg s) 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(st rSQL, Conn1)
Conn1.Open()
Rdr1 = Cmd1.ExecuteRea der()
cboCust.DataSou rce = Rdr1
cboCust.DataBin d()
cboCust.Items.I nsert(0, "Select Customer")
cboCust.Selecte dIndex = 0
Rdr1.Close()
Conn1.Close()
End If
End Sub
Private Sub cboCust_Selecte dIndexChanged(B yVal sender As
System.Object, ByVal e As System.EventArg s) Handles
cboCust.Selecte dIndexChanged
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(st rSQL2, Conn2)
Conn2 = New OleDbConnection (strConn)
Dim prmCustomer As OleDbParameter = New
OleDbParameter( "@customer" , OleDbType.VarCh ar, 50)
prmCustomer.Val ue = cboCust.Selecte dItem.Value
Cmd2.Parameters .Add(prmCustome r)
Cmd2.Connection = Conn2
Conn2.Open()
Rdr2 = Cmd2.ExecuteRea der()
cboAssy.DataSou rce = Rdr2
cboAssy.DataBin d()
cboAssy.Items.I nsert(0, "Select Assembly")
cboCust.Selecte dIndex = 0
Rdr2.Close()
Conn2.Close()
End Sub
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!