aspnet-js-aspxclientlistbox-dot-additem-x28-text-x29.md
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.
AddItem(
text: string | string[],
value?: any,
imageUrl?: string
): number
| 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.
|
| Type | Description |
|---|---|
| number |
The added item’s index.
|
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:
true.true.See Also