Print Page | Close Window

Onclick movenext

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=2594
Printed Date: 29 March 2026 at 7:46pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Onclick movenext
Posted By: pmormr
Subject: Onclick movenext
Date Posted: 10 May 2003 at 9:00pm

I have two images (basically next and last). when the person clicks on them i wish to have the recordset goto the last or next record. do i have to create a variable that stores the next record in it and then do something like this http://myhost/myfile.asp?id=next - http://myhost/myfile.asp?id=next or is there something easier?



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Replies:
Posted By: farrukh
Date Posted: 11 May 2003 at 3:08am
simple generate the id numbers of ur records so if user click on the previous its shows http://myhost/myfile.asp?id=1 - http://myhost/myfile.asp?id=1 and for the next it shows http://myhost/myfile.asp?id=3 - http://myhost/myfile.asp?id=3 because it currently shows the record whose id is 2.

-------------
i have collected some nice avatars (37) and smileys (227) here you can download
http://www24.brinkster.com/webmastertool/download.html


Posted By: Scotty32
Date Posted: 12 May 2003 at 12:46pm

you cant just do it like that... think about if he deletes "id 3" he'll just get an error

i dont know how to do this, but am sure sumone else can tell you



Posted By: pmormr
Date Posted: 12 May 2003 at 2:40pm
or if i'm at the BOF or EOF

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: pmormr
Date Posted: 12 May 2003 at 5:07pm

i tried using the following...

<a href="<%rs.movenext%>">Click Here</a>

it gives me an error. i thought that would work...



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: farrukh
Date Posted: 13 May 2003 at 2:14am

suppose if you have a 2 fields. one of them is Football's Celebrities Names and second one is their its.
four records
table tblfootball
1   Beckham
2   Ronaldo
3   Zidane
4   Batistuta

If you give <a href="<%rs.movenext%>">Click Here</a>
then it shows <a href="beckham"> Click Here </a>

simply make a
sql = "select * from tblfootball"

if rs.BOF = true then
 do nothing
else
 rs.MovePrevious
 strPrevious = "< a href=""" & rs.fields(1) & """> Previous </a>"
end if

rs.movenext
response.write rs.fields(0)
****Result Would Be *****
Beckham
*** End Result ***

if rs.EOF = true then
 do nothing
else
 rs.movenext
 strNext = "<a href=""" & rs.fields(1) & """> Next </a>"
End if

response.write strPrevious & " &nbsp; &nbsp; " & strNext
************* Expected Result **************
shows not next button like this
<a href="yourpage.asp?FID=2"> Next </a>
and the Id 2 is belong to Ronaldo
***************************************
remind u the next record is fetched from database by id
do alter in ur query
if request.querystring("FID") = "" then
sql = "select * from tblfootball"
else
sql = "select * from tblfootball where id =" & request.querystring("FID") ""
end if



-------------
i have collected some nice avatars (37) and smileys (227) here you can download
http://www24.brinkster.com/webmastertool/download.html



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net