asp.net.ph

ListBox.SelectionMode Property

System.Web.UI.WebControls Namespace   ListBox Class


Sets or retrieves a value indicating whether one or more items can be selected in a ListBox control.

Syntax


Inline <asp:listbox selectionmode = enumValue ... >
Script ListBox.SelectionMode = [ enumValue ]

Property Value


enumValue One of the ListSelectionMode enum values.

The property is read/write with a default value of Single.

Exceptions


Exception Type Condition
ArgumentException The given selection mode is not one of the ListSelectionMode values.

Remarks

Use the SelectionMode property specify the mode behavior of the ListBox control ( whether one or more items can be concurrently selected ).

By default, only a single item can be selected. Setting this property to ListSelectionMode.Multiple specifies that more than one item can be selected.

To determine multiple selected items, you need to loop through the ListBox.Items collection and test the Selected property of each item.

Example

The following examples demonstrate using the SelectionMode property of a ListBox control, and how multiple selected items can be determined.

Using the ListControl.DataValueField Property
Run Sample | View Source
Dynamically Retrieving Data From Any SQL Server Source
Run Sample | View Source
Using Views Example: Sales Summary
Run Sample | View Source
See Also

ListBox Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph