Back to Devexpress

ListEditItem.Selected Property

aspnet-devexpress-dot-web-dot-listedititem-52e09568.md

latest4.7 KB
Original Source

ListEditItem.Selected Property

Gets or sets whether a list box item is selected.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(false)]
public bool Selected { get; set; }
vb
<DefaultValue(False)>
Public Property Selected As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true if an item is selected; otherwise, false.

|

Remarks

By default, only one list box item can be selected at once. To select more than one item, set the ASPxListBox.SelectionMode property to ListEditSelectionMode.Multiple or ListEditSelectionMode.CheckColumn.

For more information about multiple selection, read the Multi-Selection Mode topic.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Selected 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-web-forms-scheduler-custom-adaptive-form-using-templates/CS/WebApplication1/DevExpress/ASPxSchedulerForms/AppointmentForm.ascx.cs#L238

csharp
foreach(ListEditItem editItem in listBox.Items) {
    if(editItem.Selected)
        result.Add(editItem.Text);

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

csharp
foreach (object obj in checkedItems) {
    control.Items.FindByValue(objectSpace.GetKeyValue(obj)).Selected = true;
}

asp-net-web-forms-scheduler-custom-adaptive-form-using-templates/VB/WebApplication1/DevExpress/ASPxSchedulerForms/AppointmentForm.ascx.vb#L247

vb
For Each editItem As ListEditItem In listBox.Items
    If editItem.Selected Then
        result.Add(editItem.Text)

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

vb
For Each obj As Object In checkedItems
    control.Items.FindByValue(objectSpace.GetKeyValue(obj)).Selected = True
Next obj

See Also

SelectionMode

SelectedItems

SetSelectedIndex(index)

GetSelectedItem

GetSelectedItems

GetSelectedIndices

GetSelectedValues

UnselectItems(items)

UnselectValues(values)

UnselectIndices(indices)

UnselectAll

ListEditItem Class

ListEditItem Members

DevExpress.Web Namespace