Please enable JavaScript to view this site.

Navigation: Advanced topics > Events

Page life cycle overview

Scroll Prev Next More

 

When a generated app runs a page, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, retrieving data, instantiating controls and rendering.

 

It is important to understand the page life cycle so that you can write code at the appropriate life-cycle stage for the effect you intend.

Global Events

AfterAppInit

Occurs upon loading each page before any processing takes place.

Use this event to override any global ASPRunner.NET variables.

 

Check the description area in the Event editor to find the list of available global variables.

AfterTableInit

Occurs upon loading each page before any processing takes place, right after AfterAppInit.

Use this event to override any table-specific ASPRunner.NET variables.

 

Check the description area in the Event editor to find the list of available global variables.

ModifyMenuItem

This event is executed for each Menu item before a page is displayed in the browser.

Use this event to modify or hide menu items.

List/Print pages

BeforeProcessList

BeforeProcessPrint

Occurs when the page processing starts and the database connection is established.

 

Use this event for the following:

change the database connection to point to another database;

read request data and populate session variables;

redirect to another page.

BeforeDelete

This event is executed once for each record to be deleted.

 

Use this event for the following:

prevent a record from being deleted;

save the deleted record in another table.

AfterDelete

Occurs once for each record after it was deleted.

AfterMassDelete

Occurs after a bulk delete operation.

BeforeProcessRowList

BeforeProcessRowPrint

Occurs after a database record is retrieved from the database before formatting is applied.

 

Use this event for the following:

modify the value of any column;

prevent certain records from being displayed on the page;

calculate/display your totals and subtotals.

BeforeMoveNextList

BeforeMoveNextPrint

Occurs after a database record is retrieved from the database and formatting is applied.

 

Use this event for the following:

display an empty row or a header between group of records;

apply additional formatting to any column.

BeforeShowList

BeforeShowPrint

Occurs after the page is processed and ready to be displayed in the browser.

 

Use this event for the following:

define a new template variable or change the value of an existing one;

display a different template.

OnPageLoad

Occurs after the page is displayed in the browser. Use this event to work with the "edit" controls using the JavaScript API.

Edit/Add pages

BeforeProcessEdit

BeforeProcessAdd

Occurs when the page processing starts and the database connection is established.

 

Use this event for the following:

change the database connection to point to another database;

read request data and populate session variables;

redirect to another page.

BeforeEdit

BeforeAdd

Occurs before new data is written to the database. Works in all add/edit modes: Inline Add/Edit, Regular Add/Edit and an Add/Edit page in a popup.

 

Use these events for the following:

prevent a data record from being added or edited;

send an email;

save old record in another table;

add a record to the log table.

AfterEdit

AfterAdd

Occurs after data was written to the database. Works in all add/edit modes: Inline Add/Edit, Regular Add/Edit and an Add/Edit page in a popup.

 

Use this event for the following:

send an email;

add a record to the log table.

ProcessValuesEdit

Occurs before the record is displayed (before the BeforeShowEdit event).

BeforeShowEdit

BeforeShowAdd

Occurs after the page is processed and ready to be displayed in the browser.

 

Use this event for the following:

define a new template variable or change the value of an  existing one;

display a different template.

OnPageLoad

Occurs after the page is displayed in the browser. Use this event to work with the "edit" controls using the JavaScript API.

Login/Registration pages

BeforeProcessLogin

BeforeProcessRegister

Occurs when the page processing starts and the database connection is established.

 

Use this event for the following:

change the database connection to point to another database;

read request data and populate session variables;

redirect to another page.

BeforeLogin

BeforeRegister

Occurs before the user logs in or the new user data is written to the database.

 

Use this event for the following:

prevent the user from being logged in or registered;

send an email;

add a record to the log table.

AfterSuccessfulLogin

AfterSuccessfulRegistration

Occurs after the user is logged in or registered successfully.

 

Use this event for the following:

redirect user to another page;

send an email;

add a record to the log table.

AfterUnsuccessfulLogin

AfterUnsuccessfulRegistration

Occurs if the user was not logged in or was not registered.

 

BeforeShowLogin

BeforeShowRegister

Occurs after the page is processed and ready to be displayed in the browser.

 

Use this event for the following:

define a new template variable or change the value of an existing one;

display a different template.

OnPageLoad

Occurs after the page is displayed in the browser. Use this event to work with the "edit" controls using the JavaScript API.

View/Search/Report/Chart pages

BeforeProcess<PageName>

Occurs when the page processing starts and the database connection is established.

 

Use this event for the following:

change the database connection to point to another database;

read request data and populate session variables;

redirect to another page.

ProcessValuesView

Occurs before the record is displayed (before the BeforeShowView event).

BeforeShow<PageName>

Occurs after the page is processed and ready to be displayed in the browser.

 

Use this event for the following:

define a new template variable or change the value of an existing one;

display a different template.

OnPageLoad

Occurs after the page is displayed in the browser. Use this event to work with the "edit" controls using the JavaScript API.

Import page

BeforeImport

This event is executed before the import is started.

BeforeInsert

Occurs before a record is inserted. Use this event to modify the record before it is inserted.

AfterImport

This event is executed after the import is finished.

See also:

Menu builder

Session keys

ASPRunner.NET session variables

Template language

About templates

ASPRunner.NET templates

Choose pages screen

Event editor

Table Events

Global Events

Common event parameters

Tri-part events

Field events