This topic is locked

Previous and Next buttons on the View page

12/19/2008 3:33:52 AM
ASPRunnerPro Tips and tricks
J
Jane author

Here is a detailed instruction for ASPRunnerPro 6.0:

  1. proceed to the Visual Editor tab, switch to HTML mode and add following code in any place where you want to show these buttons:
    {$PreviousButton} {$NextButton}


2. add View page: Before display event on the Events tab.

Here is a sample code:

'Previous button

set rsExists = dal.TableName.Query("RecordID<" & values("RecordID"),"RecordID DESC")

if not rsExists.eof then

str = "<input type=button class=button value=Previous onclick=""window.location.href='TableName_view.asp?editid1=" & rsExists("RecordID") & "';"">"

xt.assign "PreviousButton",str

end if

rsExists.Close : set rsExists = Nothing
'Next Button

set rsExists = dal.TableName.Query("RecordID>" & values("RecordID"),"RecordID ASC")

if not rsExists.eof then

str = "<input type=button class=button value=Next onclick=""window.location.href='TableName_view.asp?editid1=" & rsExists("RecordID") & "';"">"

xt.assign "NextButton",str

end if

rsExists.Close : set rsExists = Nothing



where TableName is your actual table name, RecordID is your actual field name where key value is stored.

J
jeff.w 3/5/2009

Many thanks, this worked a treat once i changed
xt.assign "Previous",str
to
xt.assign "PreviousButton",str

Stu 4/23/2009

Jane,
Suppose this table were a detail Recordset then this would work for the Detail table where all the records belong to the same Master Record.
But if the index key of the Detail record is an Autonumber (for example) then just because record 22 belongs to Master Record key "XX" it doesn't follow that the next key, 23, also belongs to Master record "XX". It might have been added to Master Record "YY".
How would I need to modify the Next/Previous Code to match with the Master key of "XX" so I get all Detail records belonging to "XX" and not All Detail records in sequence irrespective of which Master Record they belong to?
For example, is it in the .dal Query where the Query needs to be something like
set rsExists = dal.TableName.Query("RecordID<" & values("RecordID" & " AND " & "RecordID2)=" & TheValueOfTheMasterkey" ,"RecordID DESC")
Regards,
Stu

Here is a detailed instruction for ASPRunnerPro 6.0:


  1. proceed to the Visual Editor tab, switch to HTML mode and add following code in any place where you want to show these buttons:
  2. add View page: Before display event on the Events tab.

    Here is a sample code:
    where TableName is your actual table name, RecordID is your actual field name where key value is stored.