Official Content

Goes to the last group of records when paging of Grids / Free Style Grids / Tabular Grids is used.

Syntax

GridName.LastPage()

Where:

GridName
    Is the name of the control to which the method is applied.

Scope

Controls: Grid, Free Style GridTabular Grid
Generators: .NET, .NET Framework, JavaAngular

Description

When the automatic paging of a certain Grid is used (its Rows property must be set to a value other than 0), and automatic paging buttons are also provided, if, for some reason, you do not want to use those buttons, or any of them, and you want to define a specific paging action, you can then use the LastPage method as well as others related.

This method is available for:

It can only be used when the Grid has Base Table.

Nested grids support this method. 

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 time 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, the outcomes may be unexpected.  

Values

For Web Panel objects, this method may return some of the following values:

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

Samples

Event Last.Click       //Last is the name of a control included in the screen.
    MyGrid.LastPage()
EndEvent

See Also

FirstPage method
NextPage method
PreviousPage method
GotoPage method
RecordCount property
PageCount Property
Rows property
Grid paging on the Web


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant