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

G. andrew Duthie; matthew Macdonald

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

List.NET 1.1, disposable

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

The List control allows you to display a list of static strings or text links. These items can be added declaratively (through the .aspx file or configured with the property designer in Visual Studio .NET), or they can be added and examined programmatically through the Items property. This property provides a collection of MobileListItem instances, each of which can define visible text (MobileListItem.Text) and a non-visible value (MobileListItem.Value). In addition, the List control supports data binding. You simply need to set the DataSource property to a valid data source (like an System.Collections.ArrayList, System.Data.DataTable, or System.Data.DataView), and then specify the properties or fields to bind using the DataTextField and DataValueField properties.

You can apply bullets or automatic numbering to the list items using the Decoration property, and you can use the properties inherited from the base PagedControl class to split the list over multiple mobile pages. To specify that the items should be rendered as hyperlinks, set the ItemsAsLinks to True. When the user clicks an item, the ItemCommand event will be fired with information about the source item.

public class 

List : PagedControl, System.Web.UI.INamingContainer, IListControl, ITemplateable, System.Web.UI.IPostBackEventHandler { // Public Constructors public

List ( ); // 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 ListDecoration

Decoration {set; get; } public bool

HasItemCommandHandler {get; } public MobileListItemCollection

Items {get; } public bool

ItemsAsLinks {set; get; } // Protected Instance Properties protected override int

InternalItemCount {get; } // overrides PagedControl // Public Instance Methods public override void

CreateDefaultTemplatedUI (bool

doDataBind ); // overrides MobileControl public override void

EnsureTemplatedUI ( ); // overrides MobileControl // Protected Instance Methods protected override void

AddParsedSubObject (object

obj ); // overrides MobileControl protected override void

CreateChildControls ( ); // overrides System.Web.UI.Control protected virtual void

CreateItems (System.Collections.IEnumerable

dataSource ); protected override void

EnsureChildControls ( ); // overrides System.Web.UI.Control protected override void

LoadViewState (object

savedState ); // overrides MobileControl protected override bool

OnBubbleEvent (object

sender , EventArgs

e ); // overrides System.Web.UI.Control protected override void

OnDataBinding (EventArgs

e ); // overrides MobileControl protected virtual void

OnItemCommand (ListCommandEventArgs

e ); protected virtual void

OnItemDataBind (ListDataBindEventArgs

e ); // implements IListControl protected override void

OnLoadItems (LoadItemsEventArgs

e ); // overrides PagedControl protected override void

OnPageChange (int

oldPageIndex , int

newPageIndex ); // overrides PagedControl protected override void

OnPreRender (EventArgs

e ); // overrides PagedControl protected override object

SaveViewState ( ); // overrides MobileControl protected override void

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

ItemCommand ; public event ListDataBindEventHandler

ItemDataBind ; }

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) PagedControl List(System.Web.UI.INamingContainer, IListControl, ITemplateable, System.Web.UI.IPostBackEventHandler)

Returned By

System.Web.UI.MobileControls.Adapters.HtmlListAdapter.Control, System.Web.UI.MobileControls.Adapters.WmlListAdapter.Control