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

G. andrew Duthie; matthew Macdonald

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

ObjectListItem.NET 1.1, disposable

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

The ObjectListItem represents an individual item in an ObjectList. You do not create ObjectListItem instances manually; instead, they are created automatically as the list is bound. You can iterate through a collection of all the ObjectListItem instances in the list using the ObjectList.Items collection. In addition, some events (like ObjectList.ItemCommand, ObjectList.ItemSelect, and ObjectList.ItemDataBind) provide an ObjectListItem instance that identifies the appropriate item in the list.

You can determine whether or not an item is selected using the Selected property. In addition, you can use the Item property (which is the default indexer) to examine the properties or fields of the bound object. For example, if the bound object has a property named ID, you can use the syntax ObjectListItem["ID"] to retrieve its value. If you try to retrieve a property that doesn't exist, you will receive a null reference, but no error will occur.

public class 

ObjectListItem : MobileListItem { // Public Instance Properties public string

this [int

index ]{set; get; } public string

this [string

key ]{set; get; } // Public Instance Methods public override bool

Equals (object

obj ); // overrides MobileListItem public override int

GetHashCode ( ); // overrides MobileListItem // Protected Instance Methods protected override bool

OnBubbleEvent (object

source , EventArgs

e ); // overrides MobileListItem }

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) Panel(ITemplateable) TemplateContainer(System.Web.UI.INamingContainer) MobileListItem(System.Web.UI.IStateManager) ObjectListItem

Returned By

ObjectList.{CreateItem( ), Selection}, ObjectListCommandEventArgs.ListItem, ObjectListDataBindEventArgs.ListItem, ObjectListItemCollection.{GetAll( ), this}, ObjectListSelectEventArgs.ListItem, ObjectListShowCommandsEventArgs.ListItem

Passed To

System.Web.UI.MobileControls.Adapters.HtmlObjectListAdapter. RenderItemDetails(), System.Web.UI.MobileControls.Adapters.WmlObjectListAdapter. {RenderItemDetails(), RenderItemMenu( )}, ObjectListCommandEventArgs.ObjectListCommandEventArgs( ), ObjectListDataBindEventArgs.ObjectListDataBindEventArgs( ), ObjectListField.DataBindItem( ), ObjectListItemCollection.{Contains( ), IndexOf( )}, ObjectListSelectEventArgs.ObjectListSelectEventArgs( ), ObjectListShowCommandsEventArgs.ObjectListShowCommandsEventArgs( )