Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 **** Paging....
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Spoon
Average Member

Ireland
507 Posts

Posted - 16 July 2001 :  07:53:44  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
Hi all,

I have a pretty nice paging function. However, i want the visitor to be able to set the amount of records they want to see. When they dont set how many they want to see, the default value takes over, when they do set it, the script goes mad and just shows all the records. here is the code that deteremines the amount ot records to show

----------------------------------

Dim NUMRS
NUMRS = Request.FORM("PGS")
IF NUMRS = "" Then
NUMRS = 10
End If

PAGESIZE = NUMRS

-----------------------------------------

BTW, if i do it like this, the script goes mad and shows the all the records

------------------------------------------

Dim NUMRS
NUMRS = Request.FORM("PGS")
IF NUMRS = "" Then
NUMRS = "10"
End If


PAGESIZE = NUMRS

-----------------------------------------------

Could it be that if the user submits a value, the script puts it as "Newvalue" ??

Any help is greatly appreciated.

Thanks,


Regards,

Spoon, (ya all love me right?)

gor
Retired Admin

Netherlands
5511 Posts

Posted - 16 July 2001 :  09:25:08  Show Profile  Visit gor's Homepage
Spoon,

It should work like the first example you posted.
One thing to check: are you sure you are using POST ?
If you want to be able to pass the pagesize in the url, you'll need to use Request.QueryString() instead of Request.Form()
If you want to be able to both retrieve it from a form use POST and still be able to use it in a url, you can use Request() without any of the two. This last one is slower that the other two so should only be used if you want to be able to get the value no matter what method is used.

Pierre
Join the Snitz WebRing
Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 16 July 2001 :  13:48:09  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
quote:

Spoon,

It should work like the first example you posted.
One thing to check: are you sure you are using POST ?
If you want to be able to pass the pagesize in the url, you'll need to use Request.QueryString() instead of Request.Form()
If you want to be able to both retrieve it from a form use POST and still be able to use it in a url, you can use Request() without any of the two. This last one is slower that the other two so should only be used if you want to be able to get the value no matter what method is used.

Pierre
Join the Snitz WebRing



Hi Pierre,

Like you said, it should woek, but it wont :( . I dont know whats wrong with it. Im just going to pass the NUMRS on through the querystring( after collected from the form). The form is set to post. Anymore ideas??



Regards,

Spoon, (ya all love me right?)
Go to Top of Page

Id
Junior Member

USA
129 Posts

Posted - 16 July 2001 :  14:20:25  Show Profile  Visit Id's Homepage
you know what i might try doing

If Request.Form("PGS") <> "" Then
NUMRS = Request.Form("PGS")
Else
NUMRS = 10
End If

Pagesize = NUMRS


Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 16 July 2001 :  14:28:02  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
quote:

you know what i might try doing

If Request.Form("PGS") <> "" Then
NUMRS = Request.Form("PGS")
Else
NUMRS = 10
End If

Pagesize = NUMRS



Thanks for your help. but that didnt work either

Regards,

Spoon, (ya all love me right?)
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 16 July 2001 :  14:29:21  Show Profile  Visit gor's Homepage
Spoon,

Could you tell something more about the error you get when the script goes mad, did you try a

Response.write(PAGESIZE)
Response.end

right after the code you posted to check if the value is passed ok.
If it get into the variable ok, the problem is further down the road/code.

Pierre
Join the Snitz WebRing
Go to Top of Page

Id
Junior Member

USA
129 Posts

Posted - 16 July 2001 :  14:48:12  Show Profile  Visit Id's Homepage
another quick question, the pagesize variable that you're assigning the NUMRS value into, what are you doing with that? Is it just sitting there doing nothing, or are you appending it to your recordset page size later on?
i.e.


RecordSetName.PageSize = Pagesize 'or
RecordSetName.PageSize = NUMRS





Edited by - Id on 16 July 2001 14:48:53
Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 17 July 2001 :  07:09:57  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
quote:

another quick question, the pagesize variable that you're assigning the NUMRS value into, what are you doing with that? Is it just sitting there doing nothing, or are you appending it to your recordset page size later on?
i.e.


RecordSetName.PageSize = Pagesize 'or
RecordSetName.PageSize = NUMRS



Edited by - Id on 16 July 2001 14:48:53



Hi again,

Gor, the variable is being past through the script fine, i have PAGESIZE written on the page, "Set number of records to show" then a textbox with PAGESIZE is written in it.

When i dont set the var PAGESIZE the script sets to it to 10 as default, when i submit a new value of PAGESIZE through the form, no matter what number value it is, the script then just shows all the records that are in the database. I dont get an error, thats just what happens :(

ID:

The only reason NUMRS is there is cause i was trying a different way of getting it to work, thats all. NUMRS is not called again after PAGESIZE = NUMRS

Thanks for trying guys



Regards,

Spoon, (ya all love me right?)
Go to Top of Page

Id
Junior Member

USA
129 Posts

Posted - 17 July 2001 :  13:24:46  Show Profile  Visit Id's Homepage
This may be completely off the wall, but try doing this

<%
If Request.Form("PGS") <> "" Then
NUMRS = CInt(Request.Form("PGS"))
Else
NUMRS = 10
End If

Recordset.PageSize = NUMRS
%>


The reason i say convert it to an integer is because i think when it's being taken from the form it's being interpreted as a string, and I don't think you can pass a string into the pagesize.

If that doesn't work, i don't know what else to tell you to try

Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 18 July 2001 :  05:55:57  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
quote:

This may be completely off the wall, but try doing this

<%
If Request.Form("PGS") <> "" Then
NUMRS = CInt(Request.Form("PGS"))
Else
NUMRS = 10
End If

Recordset.PageSize = NUMRS
%>


The reason i say convert it to an integer is because i think when it's being taken from the form it's being interpreted as a string, and I don't think you can pass a string into the pagesize.

If that doesn't work, i don't know what else to tell you to try





Thanks so Much ID. It worked!!!! :) :) :) :)

I got rid of numrs and applied the same principal after that ---

PAGESIZE = Request.Form("PGS")
If PAGESIZE = "" Then
PAGESIZE = 10
Else
PAGESIZE = Cint(PAGESIZE)
End If

Thanks to you both of you for helping me

Thanks again :)




Regards,

Spoon, (ya all love me right?)
Go to Top of Page

Id
Junior Member

USA
129 Posts

Posted - 18 July 2001 :  11:17:14  Show Profile  Visit Id's Homepage
glad to be of service

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07