LastPage Method

Official Content
This documentation is valid for:

To page to the last group of records when paging of Grids and freestyle Grids is used.

Syntax

Grid.LastPage()

Values

0: Successful operation
1: Paging is not enabled in the Grid 
3: The Grid does not have a base table.  

Description

This event can only be used if the Grid has Base Table. The Rows property must have a value different than 0. Grids may be nested. 

The LastPage method determines what the last page will be. To this end, it uses the Rows property and the Grid RecordCount Property. Using the RecordCount property implies that the DBMS (not the generated code) sweeps the Grid base table twice (the first time to count and the second to "load"). 

The LastPage method makes it possible to have just one Load command executed per each record in the base table. Thus, if there are Ifs in the Grid.Load event, which may condition the execution of the command, or if the Load method is executed more than once for each record, outcomes may be unexpected.  

Example

Event Last.Click
    MyGrid.LastPage()
EndEvent

Scope

Objects: Web Panels
Controls: Grids, Free Style Grids
Languages: .Net, Java, Ruby (up to GeneXus X Evolution 3)

See Also

FirstPage
NextPage
PreviousPage
GotoPage
Recordcount
Pagecount
Rows property
Grid paging on the Web