Back to Devexpress

ASPxClientComboBox.AddItem(text) Method

aspnet-js-aspxclientcombobox-dot-additem-x28-text-x29.md

latest3.1 KB
Original Source

ASPxClientComboBox.AddItem(text) Method

Adds a new item to the end of the control’s item collection.

Declaration

ts
AddItem(
    text: string | string[],
    value?: any,
    imageUrl?: string
): number

Parameters

NameTypeDescription
textstringstring[]

The item’s text.

| | value | any |

The item’s value.

| | imageUrl | string |

The path to the item’s image.

|

Returns

TypeDescription
number

The position of the added item within the collection.

|

Remarks

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.

Examples

  • AddItem(String)

  • AddItem(String[])

  • ASPxClientComboBox.AddItem(String, Object)

  • ASPxClientComboBox.AddItem(String[], Object)

  • ASPxClientComboBox.AddItem(String, Object, String)

  • ASPxClientComboBox.AddItem(String[], Object, String)

Add a New Item to the Item Collection

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:

  1. Specify initial items.

  2. 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.

  3. Specify the following properties:

Online Example

View Example: How to add items to a multi-column ASPxComboBox on the client side

See Also

InsertItem

RemoveItem(index)

GetItem(index)

Add

Combo Box

ASPxClientComboBox Class

ASPxClientComboBox Members