|
Events are the fragements of ASP code executed before
or after record was added, edited, deleted, when new user registers
etc. Typical events are: send an email with old or new data record,
save data in another table, check record uniqueness, show related to
current record info.
Double click on the Event name to choose one of the predefined actions.
Typical
parameters passed to events
Dict - Scripting.Dictionary
object.
Each field on the Add/Edit form represented as
'Field name'-'Field value' pair
Example of usage:
Response.Write dict("Field1")
Where -
WHERE clause that points to current record to be edited or deleted
Example of usage:
' retrieve
record to be deleted or edited
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "select * from Table where "
& WHERE, dbConnection
' check if new field value is different from what
is stored in database
if dict("FieldName")<>rs("FieldName") then
...
Other
useful functions and values
GetRequestForm("FieldName")
- use it access any field value on Edit or Add pages
Session(strTableName &
"MasterKey") - master
table foreign key value
Request.QueryString("editid")
- on Edit/View pages stores value of first key column. To reach other
key columns values use Request.QueryString("editid2") and Request.QueryString("editid3").
ASPRunner comes with set of handy predefined code
snippets that you can use in Events.
Sample
code snippets
Send simple email
Send email with new data
Save new data in another table
Insert a record into
another table
Check if specific
record exists
Display a message on
the Web page
Redirect to another page
Custom code
Here
are some real life events
Show list of customer orders
Check if
start date is ealier than end date
Before
deleting a record check if related records exist
Speed up data entry
using events |