ListBox::SelectionMode Property

 

Gets or sets the selection mode of the ListBox control.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
property ListSelectionMode SelectionMode {
	virtual ListSelectionMode get();
	virtual void set(ListSelectionMode value);
}

Property Value

Type: System.Web.UI.WebControls::ListSelectionMode

One of the ListSelectionMode values. The default value is Single.

Exception Condition
ArgumentOutOfRangeException

The specified selection mode is not one of the ListSelectionMode values.

Use the SelectionMode property to specify the mode behavior of the ListBox control. Setting this property to ListSelectionMode.Single indicates only a single item can be selected from the ListBox control, while ListSelectionMode.Multiple specifies multiple items can be selected.

The value of the SelectionMode property is stored in view state.

The following example illustrates how to use the SelectionMode property to allow the user to select multiple selections from the ListBox control.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: