Code Adds the selected items from one listbox to other also You can remove transfered items from other listbox.
public void Page_Load() { if (!ispostback) { state.items.add(new listitem("California", "CA")); state.items.add(new listitem("Georgia", "GA")); state.items.add(new listitem("New York", "NY")); state.items.add(new listitem("Maxico", "MX")); state.items.add(new listitem("San Fransisco", "SF")); } }
public void disp(object s, commandeventargs e) { int i; if (e.commandname == "add") { statevalue.items.clear(); for (i = 0; i <= state.items.count - 1; i++) { if (state.items(i).selected) { statevalue.items.add(state.items(i).text); } } } else if (statevalue.selectedindex > -1) { for (i = statevalue.items.count - 1; i >= 0; i += -1) { if (statevalue.items(i).selected) { statevalue.items.remove(statevalue.items(i).text); } } } }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|