Selecting all rows in a weblistbox is too slow

I’ve got a weblistbox with 1000 rows. It takes 11 seconds to fill it. If you click the top row, hold shift and then click the last row, it takes about 2 seconds for the selections to finish. However, I have a button called “Select All” and when you click it the code loops through the rows and selects each one. This process takes over 2 minutes. Is there a faster way to select all rows?

I have a SelectionChanged event that shows some other buttons when the user selects some rows. I added a flag to bypass the code when the user presses the Select All button. This helped a lot but it is still taking 50 seconds to select all of the rows so I am still searching for other ideas.

Hi @Brandon Warlick

Without knowing the amount of columns, where the data come from, the code that may be executed in response to some events in your weblistbox or other considerations…did you have considered to load (view) less rows in your weblistbox and resort to some pagination technique to navigate between all of the available data? I’m sure that will alleviate the problem!

In a plain test web project with a webpage and a weblistbox, populating 1000 rows takes a blink.

If you can provide more information to try to find the cause of the problem… that would be great.

Javier

Javier, most of the time the users of the web app have only about 50 rows showing and selecting all of the rows is fast. But there is a use case where they must view around 1,000 rows. There are only 3-6 columns.

The problem I am having is the speed to select all of the rows in the listbox. When I run the code below, it takes around 50 seconds.

[code]self.bIgnoreEvents = True
var iLast as Integer = List.LastIndex

for i as integer = 0 to iLast
list.Selected(i) = True
next
bIgnoreEvents = False
[/code]

If the listbox selectionchanged event I have:

[code]if bIgnoreEvents = False then
if me.ListIndex = -1 then
GridFilter.ActionButtonsVisible = False
else
GridFilter.ActionButtonsVisible = True
end if
end if

[/code]

maybe the time waste is some kind of redraw.
did you try to hide it before you select 1000 rows
and then show it again.

using the profiler should help you locate where the time is wasted ?