ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 644
نمايش فراداده

SelectionList.NET 1.1, disposable

System.Web.UI.MobileControls (system.web.mobile.dll)class

The SelectionList control presents a list of items from which the user can choose. The SelectionList is different from the List control in several ways, namely, it supports multiple selection, does not raise server-side selection events, and does not support pagination. In addition, it supports drop-down and combo-box styles (through the SelectType property). Typically, you will use the List control as a navigation tool where each item acts as a command, and the SelectionList to display a list of items that will be used in conjunction with another operation.

You can retrieve the currently selected MobileListItem from the Selection property, or its index from the SelectedIndex property. If the list supports multiple selection (is type ListSelectType.MultiSelectListBox) this will only return the first selected item. To find all selected items you will need to iterate over the collection of Items and check the Selected property of each one.

public class 

SelectionList : MobileControl, System.Web.UI.IPostBackDataHandler, IListControl { // Public Constructors public

SelectionList ( ); // Public Instance Properties public virtual string

DataMember {set; get; } public virtual object

DataSource {set; get; } public string

DataTextField {set; get; } public string

DataValueField {set; get; } public bool

IsMultiSelect {get; } public MobileListItemCollection

Items {get; } public int

Rows {set; get; } public int

SelectedIndex {set; get; } public MobileListItem

Selection {get; } public ListSelectType

SelectType {set; get; } public string

Title {set; get; } // Protected Instance Methods protected override void

AddParsedSubObject (object

obj ); // overrides MobileControl protected virtual void

CreateItems (System.Collections.IEnumerable

dataSource ); protected override void

LoadViewState (object

savedState ); // overrides MobileControl protected override void

OnDataBinding (EventArgs

e ); // overrides MobileControl protected virtual void

OnItemDataBind (ListDataBindEventArgs

e );// implements IListControl protected override void

OnPreRender (EventArgs

e ); // overrides MobileControl protected virtual void

OnSelectedIndexChanged (EventArgs

e ); protected override object

SaveViewState ( ); // overrides MobileControl protected override void

TrackViewState ( ); // overrides MobileControl // Events public event ListDataBindEventHandler

ItemDataBind ; public event EventHandler

SelectedIndexChanged ; }

Hierarchy

System.Object System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor) MobileControl(System.Web.UI.IAttributeAccessor) SelectionList(System.Web.UI.IPostBackDataHandler, IListControl)

Returned By

System.Web.UI.MobileControls.Adapters.HtmlSelectionListAdapter.Control, System.Web.UI.MobileControls.Adapters.WmlSelectionListAdapter.Control