GotoPage method

Official Content
This documentation is valid for:

Allows direct access to a specific group of registers, when the automatic paging of Grids and Free Style Grids is used.

Syntax

Grid.GotoPage(page-number)

Where:
Grid
    Grid control

page-number
    Is a numeric value

Scope

Controls: Grid, Free Style Grid
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3)

Description

This method can be used in Web Panels, but only when the grid has Base Table. The Rows property must have a value different from 0. Grids may be nested. 

This method's efficiency is associated with the efficiency of the definition of the corresponding grid navigation. In other words, if the grid has good response times without paging, these times will be similar to with paging.

Values

This method may return some of the following values:

Value Result
0 Successful operation
1 The paging is not enabled in the grid

Samples

In this example, there is a grid (GSearchResults) with the result of a search and, another one (GPages) with the number of pages of the first one, so as to allow a fast access paging.

Event Refresh
    &PageCounts = GSearchResults.PageCount
EndEvent  

Event GPages.Load
    if &PageCounts > 1
       &Count = 1
       Do while &Count <= &PageCounts
          &PageNumber = &Count
           SFPages.Load()
          &Count += 1
       EndDo
    EndIf
EndEvent  

Event &PageNumber.Click
    GSearchResults.GotoPage(&PageNumber)
EndEvent

See Also

FirstPage
NextPage
LastPage
PreviousPage Method
Rows property
Grid paging on the Web