Is there any way to append some items to List box, without retrieving all items through AJAX?

A

Anjan Bhowmik

Suppose i have a multi-select list box which loads data from a table in a
SQL Server 2005 Database.

This list box loads all rows from the table, which has around 2000 rows. So
when databinding all 2000 rows will be fetched from database and bound to
the List box. Which is fairly a time consuming process.

Now when i insert 5 more values into the database and call list box's
DataBind() method, it will return all 2005 rows. So, continuing this process
it will take more and more time to load and manipulate data through the list
box, As daily i would have to add 10-15 rows of data to the table.

My question is, Can i add the newly added rows to the existing items of the
list box by any means using AJAX? That means if i add 1 row to the table, i
want to fetch that single row and then add it to the list box's existing
items. This can improve the performance of the system very much.

But the question is "IS IT POSSIBLE?"
 
M

Misbah Arefin

you could change your SELECT query to fetch records with ID greater than the
last item in the listbox and iterate over the DataTable returned adding each
item to the listbox.items collection
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top