G
Guest
I created a dropdown list and a datagrid in a webform. When a customer's name
is selected in the dropdown list, a "SelectedIndexChanged" event is raised
and the orders for that customer would be displayed in the datagrid.
The following code was written but the orders were not displayed after a
customer is selected from the dropdown list. Anyone knows what's wrong ?
************************************************
Private Sub lstCustomer_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles lstCustomer.SelectedIndexChanged
Dim drNew As New DataRelation("CustOrders",
ds.Tables("Customers").Columns("CustomerID"),
ds.Tables("Orders").Columns("CustomerID"))
Dim strCurrent As String = lstCustomer.SelectedItem.Value
Dim dvCustOrders As New DataView(ds.Tables("Customers"))
Dim drView As DataRowView
dvCustOrders = drView.CreateChildView(drNew)
dvCustOrders.RowFilter = "CustomerID='" & strCurrent & "'"
dgCustOrders.DataSource = dvCustOrders
dgCustOrders.DataBind()
End Sub
is selected in the dropdown list, a "SelectedIndexChanged" event is raised
and the orders for that customer would be displayed in the datagrid.
The following code was written but the orders were not displayed after a
customer is selected from the dropdown list. Anyone knows what's wrong ?
************************************************
Private Sub lstCustomer_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles lstCustomer.SelectedIndexChanged
Dim drNew As New DataRelation("CustOrders",
ds.Tables("Customers").Columns("CustomerID"),
ds.Tables("Orders").Columns("CustomerID"))
Dim strCurrent As String = lstCustomer.SelectedItem.Value
Dim dvCustOrders As New DataView(ds.Tables("Customers"))
Dim drView As DataRowView
dvCustOrders = drView.CreateChildView(drNew)
dvCustOrders.RowFilter = "CustomerID='" & strCurrent & "'"
dgCustOrders.DataSource = dvCustOrders
dgCustOrders.DataBind()
End Sub