Case #16 - How can I intercept the navigation buttons clicks to insert my own code?

ASPdb exports the following button click state (lowercase text) -

top | prev | next | bottom | rowplus | rowminus | gridcolplus | gridcolminus | formplus | formminus | filter | applyfilter | resetfilter | download | color | reload | add | update | delete | selecttable | index::n (n=Grid Index number)| applyadd | applyupdate | applydelete

Grid index number (n) is the actual record index and starts with “0”.

 ** applyadd, applydelete and applyupdate does not apply to Edit Mode, only to individual modes.

The following example intercepts the “Apply Filter” button and extract the values off the filter screen (assumes dbUnit = 123). –

Example #1

<%
Response.write("<center><h3> Test button export<BR></h3></center>")
if request("ASPdbClick_123")="applyfilter" then
response.write("<B>Intercepted LastName Field Value as - " & request.form("LastName")(3) & "</B><BR>")
'Note, use (1) instead of (3) above if dbFilterFlds = "Style=Simple"
end if
Set X = Server.CreateObject("ASP.DB")
X.dbQuickProps="123;NWIND;employees;grid;4,auto,lightgreen"
X.dbNavigationItem = "top,bottom,prev,next,filter"
X.ASPdb
%>


Example #2

<%
Response.write("<center><h3> Customized button and Click Interception <BR></h3></center>")
Set X=Server.CreateObject("ASP.DB")
if request("aspDBClick_13")="Special" then
X.dbGridDisplayFlds="0,1,2,3"
end if
X.dbQuickProps="13;NWIND;employees;grid;4,auto,lightgreen"
X.dbCustomButtons="MyBut,,#me#?aspDBClick_13=Special"
X.ASPdb
%>

This example illustrate how to create and intercept your own button click to alter the properties.

Example #3

<%
RC=request("ASPdbClick_123")
if left(RC,7)="index::" then
response.write("<B>You just selected record #" & mid(RC,8,10)+1 & "</B><BR>")
end if 
Set X = Server.CreateObject("ASP.DB")
X.dbQuickProps="123;NWIND;employees;Both;4,auto,lightgreen"
X.dbNavigationItem = "top,bottom,prev,next,filter"
X.ASPdb
%> 

This example illustrate how to retireve the selected record number. remember that record number starts at 0.

Notes -