Click to See Complete Forum and Search --> : CheckBox Qst
Let's say I have n database records. I display them all on asp
page giving id, filename and checkbox associated with each entry.
Now, the user can delete any number of files by checking boxes
on the right. How do we know what was selected?
id file1 box1
id file2 box2
id file3 box3
id file4 box4
.. ..... ....
example:
234 x.asp box
In this example, I know I can get only boxes that are checked
but how do I know the id associated with it. The id can be
anything, how do I get it from asp page?
Thanks for your time.
---------
Please note that it might be more programming qst on how to do
it in general than how to pass info using asp.
Kris Eiben
08-16-2000, 08:58 AM
Make the ID part of the checkbox name, something like
response.write "<input type='checkbox' name='del" & rs("ID") & "'>"
Then on the receiving page:
delthis = "del" & ID
if request.form(delthis) then ' delete record
AT wrote in message <399a8662$1@news.devx.com>...
>
>Let's say I have n database records. I display them all on asp
>page giving id, filename and checkbox associated with each entry.
>Now, the user can delete any number of files by checking boxes
>on the right. How do we know what was selected?
>
> id file1 box1
> id file2 box2
> id file3 box3
> id file4 box4
> .. ..... ....
>
>example:
> 234 x.asp box
>
>In this example, I know I can get only boxes that are checked
>but how do I know the id associated with it. The id can be
>anything, how do I get it from asp page?
>
>Thanks for your time.
>
>---------
>Please note that it might be more programming qst on how to do
>it in general than how to pass info using asp.
>
What I've done in the past is assigned the checkboxes in arrays meaning chkbox
<incrementing number by 1> and along side the check box is a hidden field
also stored in an array, hidden <incrementing number by 1> and store the
key value with this hidden field. And also I would store the last value of
incrementing number to another hidden field to keep track of the total number
of files.
On post time:
I would get the total number of files then do a
for x= 1 to <total number> then
if request.form("chkbox" & x) = on then
<delete the record>
end if
next
Although, I think this is not the most efficient way of doing this, but it
works.
Hope that helps
"AT" wrote:
>
>Let's say I have n database records. I display them all on asp
>page giving id, filename and checkbox associated with each entry.
>Now, the user can delete any number of files by checking boxes
>on the right. How do we know what was selected?
>
> id file1 box1
> id file2 box2
> id file3 box3
> id file4 box4
> .. ..... ....
>
>example:
> 234 x.asp box
>
>In this example, I know I can get only boxes that are checked
>but how do I know the id associated with it. The id can be
>anything, how do I get it from asp page?
>
>Thanks for your time.
>
>---------
>Please note that it might be more programming qst on how to do
>it in general than how to pass info using asp.
>
devx.com
Copyright Internet.com Inc. All Rights Reserved