ASPxClientListBox.AddItem(text) Method
Adds a new item to the editor, specifying the item’s display text, associated value and displayed image, and returns the index of the added item.
Declaration
AddItem(
text: string | string[],
value?: any,
imageUrl?: string
): number
Parameters
Name | Type | Description |
---|---|---|
text | string | string[] | A string value specifying the item’s display text. |
value | any | An object specifying the value associated with the item. |
imageUrl | string | A string value specifying the path to the image displayed by the item. |
Returns
Type | Description |
---|---|
number | The added item’s index. |
Remarks
This method is not in effect, if an editor is used in multi-column mode.
Usage (JavaScript):
ASPxListBox1.AddItem('Column value', 123, 'Images/image.jpg');
Note
If an item with the specified image is added to the editor’s Items collection where no items have images yet, it is necessary to explicitly define the editor’s ItemImage.Width and ItemImage.Height properties. Otherwise, the newly added item’s image will not be displayed.
Note
The AddItem method is in effect if the control’s client API is enabled using one of the following methods:
- Set the control’s EnableClientSideAPI property to
true
. - Set the control’s EnableCallbackMode property to
true
. - Define the control’s ClientInstanceName property.
- Handle any control’s client-side event (available via the control’s ClientSideEvents property).