aspnet-js-aspxclientcombobox-dot-additem-x28-text-x29.md
Adds a new item to the end of the control’s item collection.
AddItem(
text: string | string[],
value?: any,
imageUrl?: string
): number
| Name | Type | Description |
|---|---|---|
| text | string | string[] |
The item’s text.
| | value | any |
The item’s value.
| | imageUrl | string |
The path to the item’s image.
|
| Type | Description |
|---|---|
| number |
The position of the added item within the collection.
|
Use the AddItem method to add a new item to the end of the collection and the ASPxClientComboBox.InsertItem method to add a new item at the specified index of the collection.
The AddItem method allows you to specify the item’s text, value, and image. But you cannot use this method to set a value of a hidden column item. Also, if you specify an image for an item, define the editor’s ItemImage.Width and ItemImage.Height properties. Otherwise, the editor does not display this image.
Note
Set the EnableSynchronization property to true to synchronize user actions with items between the server and the client.
AddItem(String)
AddItem(String[])
ASPxClientComboBox.AddItem(String, Object)
ASPxClientComboBox.AddItem(String[], Object)
ASPxClientComboBox.AddItem(String, Object, String)
ASPxClientComboBox.AddItem(String[], Object, String)
You can populate the control’s Items collection with new items at run time.
Follow the steps below to add a new item to the ListEditItemCollection collection:
Specify initial items.
Handle the client-side TextChanged event. If you enter a new item, the control calls the AddItem method that gets the entered text as a parameter.
Specify the following properties:
View Example: How to add items to a multi-column ASPxComboBox on the client side
See Also