Back to Devexpress

ListEditItem.Value Property

aspnet-devexpress-dot-web-dot-listedititem-7d994449.md

latest5.1 KB
Original Source

ListEditItem.Value Property

Gets or sets the item’s associated value.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(null)]
public override object Value { get; set; }
vb
<DefaultValue(Nothing)>
Public Overrides Property Value As Object

Property Value

TypeDefaultDescription
Objectnull

A Object that specifies the item’s value

|

Remarks

The Value property specifies a value associated with an item. When an item is selected in a list editor, its value is assigned to the editor’s ASPxEdit.Value property.

Note

For the list editors (such as the ASPxComboBox, ASPxListBox, ASPxCheckBoxList, and ASPxRadioButtonList) to function properly, values of all list items in their Items collection should be unique. There should not be two or more list items with the same value of the ListEditItem.Value property.

Example

View Example: Popup Control for ASP.NET Web Forms - How to show a pop-up window.

javascript
function OnComboBoxSelectedIndexChanged(s, e) {
    var item = s.GetSelectedItem();
    popup.SetContentHTML(
        "Selected item changed:

" +
        "  <strong>text=</strong>'" + item.text + "'
" +
        "  <strong>value</strong>=" + item.value + "

");
    popup.ShowAtElementByID("comboPopupAnchor");
}
aspx
<dxe:ASPxComboBox ID="cbCombo" runat="server" Width="170px" ClientInstanceName="combo">
    <ClientSideEvents SelectedIndexChanged="OnComboBoxSelectedIndexChanged" />
    <Items>
        <dxe:ListEditItem Text="Item #1" Value="0" />
        <dxe:ListEditItem Text="Item #2" Value="1" />
        <dxe:ListEditItem Text="Item #3" Value="2" />
    </Items>
</dxe:ASPxComboBox>

The following code snippets (auto-collected from DevExpress Examples) contain references to the Value property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-mvc-scheduler-custom-appointment-form/CS/Models/Scheduling.cs#L53

csharp
foreach (ListEditItem item in rawDataSource) {
    yield return new { Value = item.Value, Text = item.Text };
}

xaf-how-to-display-a-collection-property-as-a-checked-list-box/CS/DXExample.Module.Web/WebCheckedListBoxPropertyEditor.cs#L59

csharp
foreach (ListEditItem item in control.Items) {
    object obj = objectSpace.GetObjectByKey(MemberInfo.ListElementTypeInfo.Type, item.Value);
    if (item.Selected) {

asp-net-mvc-scheduler-custom-appointment-form/VB/Models/Scheduling.vb#L56

vb
For Each item As ListEditItem In rawDataSource
    Yield New With {item.Value, item.Text}
Next

xaf-how-to-display-a-collection-property-as-a-checked-list-box/VB/DXExample.Module.Web/WebCheckedListBoxPropertyEditor.vb#L58

vb
For Each item As ListEditItem In control.Items
    Dim obj As Object = objectSpace.GetObjectByKey(MemberInfo.ListElementTypeInfo.Type, item.Value)
    If item.Selected Then

See Also

ASPxComboBox.ValueType

ASPxListEdit.ValueType

ListEditItem Class

ListEditItem Members

DevExpress.Web Namespace