Back to Devexpress

ASPxListBox.SelectionMode Property

aspnet-devexpress-dot-web-dot-aspxlistbox.md

latest3.4 KB
Original Source

ASPxListBox.SelectionMode Property

Gets or sets a value that specifies item selection behavior.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(ListEditSelectionMode.Single)]
public ListEditSelectionMode SelectionMode { get; set; }
vb
<DefaultValue(ListEditSelectionMode.Single)>
Public Property SelectionMode As ListEditSelectionMode

Property Value

TypeDefaultDescription
ListEditSelectionModeSingle

One of the ListEditSelectionMode enumeration values.

|

Available values:

NameDescription
Single

Only one list box item can be selected at once.

| | Multiple |

Multiple items can be selected within the editor by clicking list items while pressing Ctrl (to add an individual item) or Shift (to select a range of items).

| | CheckColumn |

Multiple items can be selected within the editor by clicking specific check boxes or list items (the Shift key can also be used in this mode to select a range of items).

|

Remarks

This property is a wrapper of the ListBoxProperties.SelectionMode property.

Example

This part of the Multiple Selection demo illustrates how to use multi-selection mode for the ASPxListBox editor.

aspx
<dx:ASPxListBox ID="lbFeatures" runat="server" SelectionMode="CheckColumn" Height="210px"
    DataSourceID="Features" ValueField="ID" ValueType="System.String" TextField="Name">
    <ClientSideEvents SelectedIndexChanged="function(s, e) {lbModels.PerformCallback('1');}" />
</dx:ASPxListBox>
<dx:ASPxListBox ID="lbModels" runat="server" SelectionMode="CheckColumn" 
Height="210px" width="250px" ClientInstanceName="lbModels" 
DataSourceID="PhoneModels" ValueField="ID" ValueType="System.String" 
OnCallback="lbModels_Callback" >
   <Columns>
      <dx:ListBoxColumn FieldName="Name" Caption="Model" width="100%"/>
      <dx:ListBoxColumn FieldName="Price" width="50px"/>
   </Columns>
</dx:ASPxListBox>
csharp
protected void lbModels_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e) {
    FilterModels(lbFeatures.Items);
    lbModels.DataBind();
}
protected void FilterModels(ListEditItemCollection items) {
...     
}
...
vb
Protected Sub lbModels_Callback(ByVal sender As Object, ByVal e As DevExpress.Web.CallbackEventArgsBase)
    FilterModels(lbFeatures.Items)
    lbModels.DataBind()
End Sub

Protected Sub FilterModels(ByVal items As ListEditItemCollection)
' ...
End Sub

See Also

SelectionMode

List Box

ASPxListBox Class

ASPxListBox Members

DevExpress.Web Namespace