English 中文(简体)
ASP. NET在过滤后重新排序DopDownList?
原标题:ASP.NET requery DropDownList after filter?

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
问题回答

如果我不错的话,你就没有通过应用“弹道”真正做任何事情。 你们仍需要再次执行询问。 见MSDN docs here。 上面的相关点:“在采用选用方法时,使用电解器或设置过滤器”。 因此,你需要再次使用选择性方法。





相关问题
WPF Datagrid, Setting the background of combox popup

I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I ve edited the Template for a normal Combobox and it works great for selected ...

How to insert ComboBox item into ListBox? [winforms]

The question is very simple, How to insert ComboBox selected item into ListBox using c#? I have tried with this: listbox.Items.Add(combobox.SelectedItem); and some other permutations but it always ...

How do I bind a ComboBox to a one column list

I ve seen how to bind a ComboBox to a list that has columns like this: ItemsSource="{Binding Path=Entries}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=Entry}" But ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

热门标签