473,473 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Work with multiple selected items from a ListBox

I'm having an issue with a listbox.

I want to allow users to multi select items in a list box, click a button
and have them moved somewhere else.

This works fine for the the first 2 tries. However, a user also has the
ability to add these items back to the listbox (with the same value and
Text).

The new Items get moved to the bottom of the list box.

It works fine to a point, however, once I move over all items, and move 5
back, if I select all 5, it will only notice that 3 of them are
selected.though all 5 are. 2 Will be left, so when I select those 2, it will
only move 1.

Any help would be great.

here's my code:
--------------------------------------------------------------------------------
System.Collections.ArrayList arlTemp = new System.Collections.ArrayList();
foreach(ListItem li in lstAvailHeadings.Items)
{
if(li.Selected)
{
tblTemp = addSection(tblTemp,Int32.Parse(li.Value),li.Text);
arlTemp.Add(li.Value);
}
}
BindSections(tblTemp);
for(int i = 0;i<arlTemp.Count;i++)
{
for(int j = 0;j<lstAvailHeadings.Items.Count;j++)
{
if(lstAvailHeadings.Items[j].Value == arlTemp[i].ToString())
lstAvailHeadings.Items.Remove(lstAvailHeadings.Ite ms[j]);
}
}
arlTemp = null;
Nov 19 '05 #1
0 957

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Vipin Kedia | last post by:
Hi I have written a code for showing the list boxes as selected using a Listitem and the selected property of the items. Now I have 2 list boxes in my page. But it shows only the selected values...
0
by: bill yeager | last post by:
Duray, it helps in regards to knowing how to get the items that were selected in the lisbox, but I'm going in reverse --- after I get the items from the db that were selected, I'd like to be able...
1
by: sab | last post by:
Hi, We have a web form with a listbox. The listbox is a multiple select listbox and has data that looks something like: ALL Unit 1 Unit 2 Unit 3 Note: "ALL" is always the first item in...
8
by: Vipin Kedia | last post by:
Hi I have written a code for showing the list boxes as selected using a Listitem and the selected property of the items. Now I have 2 list boxes in my page. But it shows only the selected values...
10
by: ads | last post by:
hi, after binding the dropdownlist to a datasource, ive experience this error "Cannot have multiple items selected in a dropdownlist" after using the code:...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.