DekGenius.com
[ Team LiB ] Previous Section Next Section

ObjectList.NET 1.1, disposable

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

The ObjectList control is a data-bound list that allows you to display multiple pieces of information from System.Data.DataRow objects in a System.Data.DataTable, or any other type of object in a collection. Unlike the simpler List control, you cannot directly add items to or remove items from an ObjectList. Instead, you must set the DataSource property and call the DataBind( ) method.

The appearance of the ObjectList depends on the type of mobile device and the control property settings. Usually, the ObjectList appears as a single list of values drawn from the data-bound object. For example, if you are binding a table of customers, you might configure the ObjectList to display a list of customer IDs by setting the LabelField property to "ID". The user can then select the ID (on a WML browser) or click the "More" link (on an HTML browser) to show the full item information and any item-specific commands you have defined. You can specify the fields that will be shown in the detailed view in one of two ways. If you set AutoGenerateFields to True, all the fields (or public properties) will be shown for the bound objects. Alternatively, set AutoGenerateFields to False and add a collection of ObjectListField instances (one for each field or property you want to bind) to the Fields collection. In addition, you can configure the rendering of the control so that it creates a table that shows multiple fields for each item. This is only supported for HTML devices. To enable this behavior, set the TableFields to a list of property or field names separated by semicolons (as in "ID;FirstName;LastName").

The ObjectList also allows you to define commands that can be invoked for any item in the list. You can define these commands by adding ObjectListCommand instances to the Commands collection. Visual Studio .NET provides rich designer support for the ObjectList control, including a property builder that allows you to specify bound columns and define list commands.

public class ObjectList : PagedControl, System.Web.UI.INamingContainer, ITemplateable, 
        System.Web.UI.IPostBackEventHandler {
// Public Constructors
   public ObjectList( );
// Public Static Properties
   public static string SelectMoreCommand{get; }
// Public Instance Properties
   public IObjectListFieldCollection AllFields{get; }
   public bool AutoGenerateFields{set; get; }
   public string BackCommandText{set; get; }
   public virtual ObjectListCommandCollection Commands{get; }
   public Style CommandStyle{set; get; }
   public virtual string DataMember{set; get; }
   public virtual object DataSource{set; get; }
   public string DefaultCommand{set; get; }
   public Panel Details{get; }
   public string DetailsCommandText{set; get; }
   public virtual ObjectListFieldCollection Fields{get; }
   public bool HasItemCommandHandler{get; }
   public virtual ObjectListItemCollection Items{get; }
   public string LabelField{set; get; }
   public int LabelFieldIndex{get; }
   public Style LabelStyle{set; get; }
   public string MoreText{set; get; }
   public int SelectedIndex{set; get; }
   public ObjectListItem Selection{get; }
   public int[ ] TableFieldIndices{get; }
   public string TableFields{set; get; }
   public ObjectListViewMode ViewMode{set; get; }
// Protected Instance Properties
   protected override int InternalItemCount{get; }               // overrides PagedControl
// Public Instance Methods
   public void CreateTemplatedItemDetails(bool doDataBind);
   public void CreateTemplatedItemsList(bool doDataBind);
   public override void DataBind( );                 // overrides System.Web.UI.Control
   public override void EnsureTemplatedUI( );        // overrides MobileControl
   public void PreShowItemCommands(int itemIndex);
   public void RaiseDefaultItemEvent(int itemIndex);
   public bool SelectListItem(int itemIndex, bool selectMore);
// Protected Instance Methods
   protected override void AddParsedSubObject(object obj);      // overrides MobileControl
   protected void CreateAutoGeneratedFields(System.Collections.IEnumerable dataSource);
   protected override void CreateChildControls( );                // overrides System.Web.UI.Control
   protected virtual ObjectListItem CreateItem(object dataItem);
   protected virtual void CreateItems(System.Collections.IEnumerable dataSource);
   protected override void EnsureChildControls( );                // overrides System.Web.UI.Control
   protected override void LoadPrivateViewState(object state);  // overrides PagedControl
   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(ObjectListCommandEventArgs e);
   protected virtual void OnItemDataBind(ObjectListDataBindEventArgs e);
   protected virtual void OnItemSelect(ObjectListSelectEventArgs e);
   protected override void OnLoadItems(LoadItemsEventArgs e);    // overrides PagedControl
   protected override void OnPreRender(EventArgs e);            // overrides PagedControl
   protected virtual void OnShowItemCommands(ObjectListShowCommandsEventArgs e);
   protected override object SavePrivateViewState( );             // overrides PagedControl
   protected override object SaveViewState( );                    // overrides MobileControl
   protected override void TrackViewState( );                     // overrides MobileControl
// Events
   public event ObjectListCommandEventHandler ItemCommand;
   public event ObjectListDataBindEventHandler ItemDataBind;
   public event ObjectListSelectEventHandler ItemSelect;
   public event ObjectListShowCommandsEventHandler ShowItemCommands;
}

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

Returned By

System.Web.UI.MobileControls.Adapters.HtmlObjectListAdapter.Control, System.Web.UI.MobileControls.Adapters.WmlObjectListAdapter.Control

    [ Team LiB ] Previous Section Next Section