Back to Devexpress

ListEditItem Class

aspnet-devexpress-dot-web-823b9e09.md

latest6.1 KB
Original Source

ListEditItem Class

A list item.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class ListEditItem :
    ListEditItemBase
vb
Public Class ListEditItem
    Inherits ListEditItemBase

The following members return ListEditItem objects:

Show 14 links

Remarks

The ListEditItem class implements the item functionality of a list editor (for instance, the ASPxListBox, ASPxRadioButtonList, or ASPxComboBox).

The ListEditItemCollection collection contains instances of the ListEditItem object. To access this collection, use the Items property (for instance, the ASPxListEdit.Items and ASPxAutoCompleteBoxBase.Items properties).

Create an Item

Add a ListEditItem object to the ListEditItemCollection collection and specify item characteristics:

Design Time

aspx
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server">
    <Items>
        <dx:ListEditItem Text="Alexandra Camino" Value="1" />
        <dx:ListEditItem Text="Alexander Feuer" Value="2" />
        <dx:ListEditItem Text="Ana Trujillo" Value="3" />
    </Items>
</dx:ASPxComboBox>

Run Time

csharp
using DevExpress.Web;
//...
protected void Page_Load(object sender, EventArgs e) {
    ASPxComboBox cb = new ASPxComboBox();
    cb.ID = "ASPxComboBox1";
    formLayoutDetails.Controls.Add(cb);

    // Add items to the drop-down list.
    cb.Items.Add("Alexandra Camino", "1");
    cb.Items.Add("Alexander Feuer", "2");
    cb.Items.Add("Ana Trujillo", "3");
}

Access an Item

Use the Item[Int32] property to access an individual item by its index in the item collection.

csharp
ListEditItem a = combobox.Items[0];

Add a New Item to the Data Source

You can populate the data source with new items at run time.

Follow the steps below to add an item to the data source:

  1. Handle the client-side TextChanged event. If you enter a new item, the control sends a callback to the server with the typed text as a parameter.

  2. Handle the server-side ASPxAutoCompleteBoxBase.Callback event raised by the PerformCallback method.

  3. Set the EnableViewState property to false. In this mode, the control does not maintain its view state.

Implements

IStateManager

IPropertiesOwner

IExpressionsAccessor

Inheritance

Object StateManager CollectionItem ListEditItemBase ListEditItem ToolbarListEditItem

CardViewGroupSelectorItem

ToolbarCustomListEditItem

ToolbarCustomCssListEditItem

BootstrapListEditItem

See Also

ListEditItem Members

ListEditItemCollection

DevExpress.Web Namespace