Author |
Topic |
|
Spoon
Average Member
Ireland
507 Posts |
Posted - 16 July 2001 : 07:53:44
|
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
|
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 |
|
|
Spoon
Average Member
Ireland
507 Posts |
Posted - 16 July 2001 : 13:48:09
|
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?) |
|
|
Id
Junior Member
USA
129 Posts |
Posted - 16 July 2001 : 14:20:25
|
you know what i might try doing
If Request.Form("PGS") <> "" Then NUMRS = Request.Form("PGS") Else NUMRS = 10 End If
Pagesize = NUMRS
|
|
|
Spoon
Average Member
Ireland
507 Posts |
Posted - 16 July 2001 : 14:28:02
|
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?) |
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 16 July 2001 : 14:29:21
|
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 |
|
|
Id
Junior Member
USA
129 Posts |
Posted - 16 July 2001 : 14:48:12
|
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 |
|
|
Spoon
Average Member
Ireland
507 Posts |
Posted - 17 July 2001 : 07:09:57
|
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?) |
|
|
Id
Junior Member
USA
129 Posts |
Posted - 17 July 2001 : 13:24:46
|
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
|
|
|
Spoon
Average Member
Ireland
507 Posts |
Posted - 18 July 2001 : 05:55:57
|
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?) |
|
|
Id
Junior Member
USA
129 Posts |
Posted - 18 July 2001 : 11:17:14
|
glad to be of service
|
|
|
|
Topic |
|