Navigate pages?

Navigate pages?

am 22.12.2004 07:19:16 von Targa

I currently use a pulldown which holds all customer names. When a customer
is selected, it takes the user to a detail page.
Basically using the autonumber ID field.

Select * from myTable where ID = ID

I would like to allow the user to navigate to previous or next records from
the detail page.
ie << Previous Record | Next Record >>

How can I do this?

Re: Navigate pages?

am 22.12.2004 07:34:13 von gerard.leclercq

What you want to dio calls PAGING. Here an exemple. You can set the variable
to 1 if you only wish to see 1 record.
http://www.juicystudio.com/tutorial/asp/paging.asp

Re: Navigate pages?

am 22.12.2004 07:39:06 von gerard.leclercq

A second way is:



Select * from table where ID=ID

Select case Request.Form("action")

Case "N"
MoveNext

Case "P"
MovePrevious

Case Else
'do nothing
End Select

Show Record

Re: Navigate pages?

am 22.12.2004 11:53:43 von McKirahan

"Targa" wrote in message
news:uXUOw3#5EHA.2608@TK2MSFTNGP10.phx.gbl...
> I currently use a pulldown which holds all customer names. When a customer
> is selected, it takes the user to a detail page.
> Basically using the autonumber ID field.
>
> Select * from myTable where ID = ID
>
> I would like to allow the user to navigate to previous or next records
from
> the detail page.
> ie << Previous Record | Next Record >>
>
> How can I do this?

Are the names in the pulldown in order by ID or by name?

If there not in order by ID then you can use an array and a dictionary to
identify which is the next and previous relative to each ID.



The values above represent the ID of the name.

Dim intIDX
Dim arrNAM(3,1)
arrNAM(0,0) = "Alan"
arrNAM(0,1) = 33
arrNAM(1,0) = "Billy"
arrNAM(1,1) = 44
arrNAM(2,0) = "Joe"
arrNAM(2,1) = 11
arrNAM(3,0) = "Mary"
arrNAM(3,1) = 22
Dim intNAM
intNAM
Dim strNAM

Dim objDIC
Set objDIC = CreateObject("Scripting"Dictionary")
objDIC.Add "Joe", 2
objDIC.Add "Mary", 3
objDIC.Add "Alan", 0
objDIC.Add "Billy", 1

So that is "Joe" is selected then you can determine that "Previous" is
"Billy" and "Next" is "Mary".

Dim strSEL
strSEL = Request.Form("pick") '= Joe
intNAM = objDic.Item(strSEL) '= 2
If intNAM > 0 Then
strNAM = arrNAM(intNAM-1,0) '= Prev = Billy
intIDX = arrNAM(intNAM-1,1)
ElseIf intNAM < UBound(arrNAM) Then
strNAM = arrNAM(intNAM+1,0) '= Next = Mary
intIDX = arrNAM(intNAM+1,1)
Else
strNAM = "BOF or EOF"
intIDX = -1
End If

The array and dictionary are built at the same time the options are.

To dynamically enlarge the array as it is built, use:

Dim arrNAM()
Do
ReDim Preserve arrNAM(intNAM)
arrNAM(intNAM,0) = objRST("Name").Value
arrNAM(intNAM,1) = objRST("ID").Value
intNAM = intNAM + 1
Loop

Re: Navigate pages?

am 23.12.2004 00:03:42 von jeff.nospam

On Wed, 22 Dec 2004 00:19:16 -0600, "Targa"
wrote:

>I currently use a pulldown which holds all customer names. When a customer
>is selected, it takes the user to a detail page.
>Basically using the autonumber ID field.
>
>Select * from myTable where ID = ID
>
>I would like to allow the user to navigate to previous or next records from
>the detail page.
>ie << Previous Record | Next Record >>
>
>How can I do this?

Paging recordsets:

http://www.aspfaq.com/show.asp?id=2120

Jeff