hi everybody. i got a list of checkboxes and radio button with the recorset paging function. let said i got the paging list << 1 2 3 4 5 >>. i set each page is 10 records. and every record got one checkbox for DELETE ID usage. in the first page, i check 5records, then i go to second page, i checked another 5records. but why it cant keep the value for the first page 5records when i go back or go to next pages? hope u all can give me some solution on it.plz help..thank you.

you probably set the checkboxes to new values. ASP does not store values for you and everytime you get "new page", they are reset. You have a choice here.. you can, on each page load, store the values in a hidden input value. Then, with asp, search the checkboxes on the page that have that value and check them if they do. If not, they won't be checked. THen under a user submit to delete, grab the value of the hidden variable and put it into an array. Then add the additional checkboxes that are checked on the page to that array, then do a loop to delete.

vuala

you probably set the checkboxes to new values. ASP does not store values for you and everytime you get "new page", they are reset. You have a choice here.. you can, on each page load, store the values in a hidden input value. Then, with asp, search the checkboxes on the page that have that value and check them if they do. If not, they won't be checked. THen under a user submit to delete, grab the value of the hidden variable and put it into an array. Then add the additional checkboxes that are checked on the page to that array, then do a loop to delete.

vuala

hi there vuala

coould you please give a code example

thanks a lot

this is not possible as the code example will be very big.. try urself and ask here if u couldnt solve that..

hi there vuala

coould you please give a code example

thanks a lot

Actually, no lol. If you post your code, I can give you an update code snippet to show you what you need to do.

For this, and most cross-page checks, you have many options, but all options you will need to store the data somewhere.

Options:
1. Use javascript and stay on the same page without going to another page at all. Using javascript (another programming language), you can load all records onto the current page and hide and show certain layers on the page. Thus, every layer is still part of the page, you can keep the elements checked.
2. Create an array after they click to the next page (most efficient and favorable). When they click to goto the next page, loop through all the checkboxes and for those who are checked, add their id's onto the array. Then, store the array in a session variable. (This can be avoided by using server.transfer method, but more coding than is required). On the following page, let them check more boxes. After they click back or next, add those checkbox id's onto the array, and restore it in the session variable. When they finally click delete, just loop through the ID's and delete. But remember, on each page, you will need to check for that session variable, loop through the id's, and check the ones that were checked previously. This isn't a big task, it's actually quite small (depending on how you layer things). Attempt it, and let me know the code to help you.
3. Store the id's in a file. This is very inefficient as if you have 1000 people viewing your site at one time and searching, you will have 1000 files, not to mention the IO (file methods) methods are very costly on your environment.
4. Delete after every page. If they wish to go to the next page, let them know that by leaving the page, they will delete teh selected users (not a user friendly program at all).
5. Don't show them pages, show it all on one page.

Let me know if you have any questions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.