asp.net.ph

ListItem.Selected Property

System.Web.UI.WebControls Namespace   ListItem Class


Sets or retrieves a value indicating whether the item is selected.

Syntax


Inline <asp:listitem selected = [ true | false ]... >
Script ListItem.Selected = [ true | false ]

This property accepts or returns only a boolean value: true if the item is selected; otherwise, false. Default value is false.

Remarks

Use the Selected property to determine whether the ListItem is currently selected in the list control that contains it. This property is commonly used when iterating through a ListItemCollection, to determine whether an item is selected.

Example

The following examples demonstrate using the Selected property to dynamically determine or specify the selected items in a ListControl at run time.

Determining Selected Items in a CheckBoxList
Run Sample | View Source
Using a DropDownList in Editable DataList
Run Sample | View Source
Using a DropDownList in Editable DataGrid
Run Sample | View Source
See Also

ListItem 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