Author |
Topic |
|
dcwebman
Junior Member
USA
105 Posts |
Posted - 26 April 2001 : 11:05:19
|
I am trying to determine the best way to do this. I am returning a recordset and use paging with the results in a table. One column of the table is a Select column that has a checkbox. More than one row can be checked and a button at the bottom pressed to process those selected rows. Now if I'm on page 1 and select some items, go to page 2 and select some more, page 3, etc., and then go back to previous pages again, those previously selected items should still be selected. Thus, when the processing button is pressed, all selected items no matter what page they were on should be processed.
I did try at one time using hidden form variables to maintain the selected ones. It got tough to manage. Another solution that works fairly easy is saving the whole recordset in a session variable with a new field added for the selected column. This works great except I read it's usually not a good idea to store the recordset in a session variable, especially if it's a big recordset.
Thus, I was looking for any other manageable, easy ways to do this. What is the best and easiest way to handle this? Thanks.
----------- Jeff |
|
MorningZ
Junior Member
USA
169 Posts |
Posted - 26 April 2001 : 16:40:04
|
disclaimer: this answer is based on if i am following you correctly
(1) Use a form collection instead, in other words, name the checkbox field the same and have the value of the checkbox equal to the ID of that line/record, for examples sake, we'll name the field "boxes"
(2) Instead of using hyperlinks to go through the pages, you will have to do a form submit, and on each sumbmission of the form pass the hidden field "boxes" as well, that way new check boxes will be appended to what was currently there....
when you are all done selecting, you would then have a different submit button and when you go to process the information a quick:
For each item in Reques.Form("boxes") blah blah blah process me Next
should do the trick for you.....
many recordset pagination examples use <a href="thispage.asp?curpage=##pagenum##">Next Page</a> , so that is the main change to a form submit instead
hope this helps somewhat
-Steve
|
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 26 April 2001 : 17:20:31
|
Yep, there is lots of press about 'don't store RS in Session'. Reminds me of buying a beautiful new sofa and promptly covering it with an ugly plastic cover.
For a smaller app, not heavily used, I'd say use Session storage until some problem shows up. It's not a real scalable solution so if your site is busy, maybe it's not the way to go.
After all, anyone using InterDev Recordset DTC's are only one checkbox away from using Session storage.
You would think that something as fundamental as paging would be built in to a database :)
====== Doug G ====== |
|
|
dcwebman
Junior Member
USA
105 Posts |
Posted - 27 April 2001 : 10:26:45
|
quote:
(1) Use a form collection instead, in other words, name the checkbox field the same and have the value of the checkbox equal to the ID of that line/record, for examples sake, we'll name the field "boxes"
(2) Instead of using hyperlinks to go through the pages, you will have to do a form submit, and on each sumbmission of the form pass the hidden field "boxes" as well, that way new check boxes will be appended to what was currently there....
This is what I tried first. Appending to the hidden form variable the selected boxes will work but if you reload a page already seen, there will be duplicates. So then you have to strip out duplicates. Too bad there isn't some option to SPLIT that strips out duplicates. Would be a lot faster than writing a function.
Thanks for the thoughts.
----------- Jeff |
|
|
MorningZ
Junior Member
USA
169 Posts |
Posted - 27 April 2001 : 11:04:02
|
hmm.. is there any kind of "sort" available for an array in VB ??
then you could sort ascending and inside the For..Next say "if ( this item = last item ) then ( ignore this item )"
|
|
|
PJamieson
Starting Member
United Kingdom
11 Posts |
Posted - 27 April 2001 : 11:12:55
|
Strangely enough, I'm just about to implement exactly the same scenario on a development site.
However, I want to be able to go back to previous pages and remove items from a list as well as add them. i.e. you decide that the item you added on page 4 isn't required any longer so you can uncheck the box. I also want to be able to add quantities to this list so that a user can tick the checkbox and add a quantity of items to go with it.
PLUS, I want the user to be able to confirm the list before finally adding it to the database.
If you solve the problem, then please let me know, otherwise I'll send you a copy of the mess that I make - if I can get it to work.
|
|
|
dcwebman
Junior Member
USA
105 Posts |
Posted - 30 April 2001 : 13:56:40
|
quote:
However, I want to be able to go back to previous pages and remove items from a list as well as add them. i.e. you decide that the item you added on page 4 isn't required any longer so you can uncheck the box. I also want to be able to add quantities to this list so that a user can tick the checkbox and add a quantity of items to go with it.
Yes, the unchecking needs to be handled too. I had done this months before and it was a mess. I'll see if I can find my old code but I doubt it. If you get a solution, I would love to have a copy. Thanks.
----------- Jeff |
|
|
PJamieson
Starting Member
United Kingdom
11 Posts |
Posted - 30 April 2001 : 15:41:15
|
Sorry, I gave up on it. It was taking too long and I'm on a tight deadline so I've put it on the back burner until I've got some time in the next couple of weeks. I can certainly get it paging, and I can get it to update, I can also get it working when there are only two pages, but I'm struggling when the paging gets past 2 pages for navigation since making the page for submission dynamic whilst allowing free movement to any page was proving too expensive in terms of time.
|
|
|
|
Topic |
|