ListView + ArrayList + Database
Posted on 2006-04-13
I have a list view control which displays items from an array list. The array list is populated with items from the database. I have implemented the sorting of items in the list view control based on which columns the user clicks on. When the user selects an item from the list view, more data about that item is queried in the database and displayed in a textbox.
The array list contains the primary key + other fields of the record.
The ListView shows only the fields for each record BUT NOT the primary key.
When the user selects an item in the listview, i get the associated primary key from the arraylist and query the database for more info which is displayed in the textbox.
I use an arraylist as an intermediary storage to hide the primary key used to get more data.
(* I use a list view because selecting an item selects an entire row, and listed items can be sorted by any column in the listview *)
Sorting or populating the list view is slow because first the data needs to be queried, the array list populated and then the items added to the list view. Is there a way to speed this up without losing the functionality in (*)?