Reputation: 107
I'm pretty new to asp net 2.0 programming and I was wondering how can I add an "all" item to a listbox, so I can filter my results by a specific criteria ( from a database ) or display all the results. Thanks in advance
Upvotes: 0
Views: 362
Reputation: 26190
One solution is to modify the DataSource of the control that relies on the selection in the ListBox:
Arrange your datasource (in my case SQLDataSource) to include the following condition:
[ColumnName] LIKE @ColumnName
Add a Parameter to the DataSource for the object that depends on the selection in the ListBox:
<asp:ControlParameter ControlID="ListBoxID" Name="ColumnName" PropertyName="SelectedValue" />
Upvotes: 1