The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientListBox.InsertItem(index, text) Method

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

Declaration

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

Parameters

Name Type Description
index number

An integer value that represents the index position.

text string | string[]

Optional Parameters

Name Type Default Description
value any null

An object that represents the item's associated value.

imageUrl string null

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