Back to Devexpress

ASPxClientListBox.InsertItem(index, text) Method

aspnet-js-aspxclientlistbox-dot-insertitem-x28-index-text-x29.md

latest2.1 KB
Original Source

ASPxClientListBox.InsertItem(index, text) Method

Adds a new item to the control’s items collection at the specified index.

Declaration

ts
InsertItem(
    index: number,
    text: string | string[],
    value?: any,
    imageUrl?: string
): void

Parameters

NameTypeDescription
indexnumber

The index position.

| | text | string | string[] | | | value | any |

An object that represents the item’s associated value.

| | imageUrl | string |

A String value specifying the path to the image displayed by the item.

|

Remarks

The control’s client-side functionality enables you to programmatically access and manipulate its particular item on the client side. Use the InsertItem method to add a new item at the specified index within the collection, or the AddItem method - to add a new item to the end of the collection. To obtain an item with the specified index use the ASPxClientListBox.GetItem method. An item can be removed from the collection by using the ASPxClientListBox.RemoveItem method.

Note that values of columns which are hidden by using their WebColumnBase.Visible property are not persisted on the client side. So, the InsertItem method can’t be used to set a hidden column’s value - all item values defined by this method should correspond to visible columns in the order of their appearance.

Usage (JavaScript):

ASPxListBox1.InsertItem(0, ['Value for the first visible column', 'Value for the second visible column'], 123, 'Images/image.jpg');

See Also

AddItem

RemoveItem(index)

GetItem(index)

Add

List Box

ASPxClientListBox Class

ASPxClientListBox Members