Copying Items from one textbox to texbox

Posted by Sanoop under ASP.NET on 11/13/2011 | Points: 10 | Views : 972 | Status : [Member] | Replies : 1
Hi friends,
I want to know how to copy only selected items from one listbox 1 to another listbox 2. Also if the selected item from listbox 1 is already present in the listbox 2 it should not be added again to listbox 2. Can anyone help me out how to solve this.
I'm not asking ASP.NET code. I'm asking the code while using toolbar.
Also we have to use listbox not checkbox


Posted by: muralikrishnasurap-12704 on: 11/22/2011 [Member] Starter | Points: 25

Friend we can use the foreach for getting selected items in one listbox and remove from selected one and insert in another listbox
for reference see below using same way you can shuffle items from listbox2 to list box1.

protected void forward_Click(object sender, EventArgs e)
foreach (ListItem li in lstbox1.Items)
if (li.Selected)
catch (Exception ex)

Best Regards
Murali Krishna.S

Sanoop, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response