aspnet-devexpress-dot-web-dot-listedititem-52e09568.md
Gets or sets whether a list box item is selected.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue(false)]
public bool Selected { get; set; }
<DefaultValue(False)>
Public Property Selected As Boolean
| Type | Default | Description |
|---|---|---|
| Boolean | false |
true if an item is selected; otherwise, false.
|
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.
foreach(ListEditItem editItem in listBox.Items) {
if(editItem.Selected)
result.Add(editItem.Text);
foreach (object obj in checkedItems) {
control.Items.FindByValue(objectSpace.GetKeyValue(obj)).Selected = true;
}
For Each editItem As ListEditItem In listBox.Items
If editItem.Selected Then
result.Add(editItem.Text)
For Each obj As Object In checkedItems
control.Items.FindByValue(objectSpace.GetKeyValue(obj)).Selected = True
Next obj
See Also