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

G. andrew Duthie; matthew Macdonald

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

PagedControl.NET 1.1, disposable

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

The PagedControl class defines the basic functionality for controls that use internal pagination, and can divide their content over multiple pages. These includes the List, LiteralText, ObjectList, and TextView controls, all of which derive from this class. To create a custom control that supports internal pagination, derive it from PagedControl. Override the ItemWeight property so that it returns the approximate weight of an individual item in the control. (The default weight is 100, which corresponds to a single line on the device using the default unit system.) Then, when rendering the control's output, call the FirstVisibleItemIndex( ) method, which will tell you the first item to render, and the VisibleItemCount( ) method to determine how many items to render. Your paged control will automatically fire the LoadItems event as needed.

public abstract class 

PagedControl : MobileControl { // Protected Constructors protected

PagedControl ( ); // Public Instance Properties public int

FirstVisibleItemIndex {get; } public int

ItemCount {set; get; } public int

ItemsPerPage {set; get; } public int

VisibleItemCount {get; } public override int

VisibleWeight {get; } // overrides MobileControl // Protected Instance Properties protected abstract int

InternalItemCount {get; } protected virtual int

ItemWeight {get; } // Public Instance Methods public override void

PaginateRecursive (ControlPager

pager ); // overrides MobileControl // Protected Instance Methods protected override void

LoadPrivateViewState (object

state ); // overrides MobileControl protected virtual void

OnLoadItems (LoadItemsEventArgs

e ); protected override void

OnPageChange (int

oldPageIndex , int

newPageIndex );// overrides MobileControl protected override void

OnPreRender (EventArgs

e ); // overrides MobileControl protected override object

SavePrivateViewState ( ); // overrides MobileControl // Events public event LoadItemsEventHandler

LoadItems ; }

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

Subclasses

List, LiteralText, ObjectList, TextView