0

I have 2 DropDownListboxes. both are based on a SQLDataSource control. When the value of one is changed, it acts as a filter on the other. The event fires fine, I change the filter on the SQLDataSource, but the list in the second DropDownList doesn't change.

I have been looking for an answer to this for hours and it's frustrating me greatly. It seems like it should be something simple like a requery command. The code in question is below.

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
If Me.DropDownList1.SelectedValue > 0 Then
Me.SqlDataSource2.FilterExpression = "Arcft_Make_ID = " & Me.DropDownList1.SelectedValue
Else
Me.SqlDataSource2.FilterExpression = ""
End If
End Sub
4

1 回答 1

0

如果我没记错的话,您实际上并没有通过应用 FilterExpression 做任何事情。您仍然需要再次执行查询。请参阅此处的 MSDN 文档。顶部的相关点:“获取或设置调用 Select 方法时应用的过滤表达式。”。所以需要再次调用 Select 方法。

于 2012-04-04T01:01:23.650 回答