Can I filter in ListBox?

0
0

 

Hi, I have a ListBox with more that 1000 Items with text and value properties.

 

I like to filter the text entered in a textbox.. For example.

 

dim txt = textbox1.text

 

For each itm in ListBox.items

if not itm.text = txt then

itm.hide()

end if

Next

 

Some idea? thanks.

 

 

  • You must to post comments
0
0

Items in a ListBox don’t have properties, they are usually just strings. If you use objects as items they are just objects that return a string. That’s the standard behavior of list boxes.

However, the items on the client (in the javascript widget of the listbox) can be hidden. So:

If you filter on the client, and you want to hide item 3, for example:

listBox1.getChildren()[3].exclude(); <– used exclude(), not hide() otherwise the item will be hidden but still used for the layout.

If you filter on the server, you have to remove the item:

this.listBow1.Items.RemoveAt(3);

 

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.