ASP.NET mobile controls provide a mechanism for automatically separating the content in your form into smaller groups of rendered content. This mechanism is pagination. When you use pagination, these groups of content are automatically formatted to fit the target device. The form also renders user interface (UI) elements that you can use to browse to other pages.
By default, pagination is not activated for a form. To activate pagination, set the Paginate property of the Form control to true. If Paginate is false, setting the Paginate property on a control within the form has no effect. The Form control also provides other properties, such as PageCount, CurrentPage, and PagerStyle, which allow you to control pagination behavior.
You can also specify pagination for a specific control on a form using the form's ControlToPaginate Property with the ID of the control.
Recommendations for Using Pagination
It is recommended that you do not use pagination for smaller interactive forms in an ASP.NET mobile Web application, such as input forms. In these cases, pagination is often redundant. However, for forms that display large amounts of text or data, pagination can be effective in displaying the information on the appropriate pages.
When you have a lot of data that changes over time, such as in the case of e-commerce sites where data is being updated constantly, you might consider using custom pagination. For more information about using custom pagination, see the Custom Pagination section later in this topic.
Some devices experience memory errors when they try to display more information than their memory can handle. Not only can pagination be effective in displaying forms with large amounts of text or data, but also, pagination prevents users from encountering this category of memory errors on their devices.
Mobile controls that are capable of automatic pagination across multiple pages without child controls use internal pagination. The List control is an example of a control that uses internal pagination. For example, a List control can paginate its own items, allowing a form to break the single list into multiple pages. Controls that do not support internal pagination must either have child controls or appear atomically on a single page.
Controls that support internal pagination use the PagedControl base class to derive pagination properties, methods, and events for internal and custom pagination. Properties such as the FirstVisibleItemIndex property provide access to the individual items on a page. Other properties provide the weight of an item and the count of visible items.
Controls that support internal pagination also provide a feature called custom pagination. Normally, such controls require the data for all pages to be provided at once, but, in the custom paginated case, the controls raise an event to load only the items for the current page. Developers specify the total number of items in the ItemCount Property (PagedControl) property. Changing the value of the ItemCount property from its default value of zero to the total number of items indicates that the control is to be custom paginated. When the control is custom paginated, it raises the LoadItems event, which can call an application-specified event handler to provide the items for the current page. The event handler retrieves the appropriate data and binds the data to the control.