Skip to main content

ASPxClientListBox.RemoveItem(index) Method

Removes an item specified by its index from the client list editor.

Declaration

RemoveItem(
    index: number
): void

Parameters

Name Type Description
index number

The index of the list item to be removed.

Example

The following section of the Moving Items Between Two List Boxes online demo illustrates how moving ASPxListBox items is implemented using the client ASPxClientListBox.GetSelectedItems, ASPxClientListBox.AddItem, ASPxClientListBox.RemoveItem, ASPxClientListBox.BeginUpdate and ASPxClientListBox.EndUpdate methods.

function AddSelectedItems() {
    MoveSelectedItems(lbAvailable, lbChoosen);
...
}

function RemoveSelectedItems() {
    MoveSelectedItems(lbChoosen, lbAvailable);
...
}
function MoveSelectedItems(srcListBox, dstListBox) {
    srcListBox.BeginUpdate();
    dstListBox.BeginUpdate();
    var items = srcListBox.GetSelectedItems();
    for(var i = items.length - 1; i >= 0; i = i - 1) {
        dstListBox.AddItem(items[i].text, items[i].value);
        srcListBox.RemoveItem(items[i].index);
    }
    srcListBox.EndUpdate();
    dstListBox.EndUpdate();
}
See Also