Click here to Skip to main content
15,921,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends i have a problem regarding using checkboxes with listview control.
i am using checkboxes in listview control .
i want to give 2 functionalities here.
1. A checkbox outside the listview , on selection of this all the data must be selected for deletion.
2. a checkbox before every row in listview control , to make multiple selection .
i am not able to access the id of row on checkbox selection .how can i do it .
Please help me .
Thanks in advance
Posted
Updated 5-Jun-11 21:04pm
v2

hi.

try this link.
list/check properties


hope it helps.
goodluck!.


-chaosgray-
 
Share this answer
 
1. For inner check boxes, you need to identify the ID (or primary key) for the record (row) on check of that check-box and then you can store this ID in a hidden control (in comma separated format). You can do this using JQuery, I'm posting code for adding the ID value, hope you can write logic for ID removal (on uncheck of checkbox):

C#
var ctrlValue = $("#hdn").val();
            ctrlValue = ctrlValue +
            $(ctrl).parents('tr').children().filter(function(index) {
                return index == 1;
            }).html() + ",";
            $("#hdn").val(ctrlValue);


2. For outer checkbox you need to indentify all the checkboxes inside the listview and set them as checked. After that you can update the hidden control to store the IDs. I'll post code for this.


Please note that I've assumed that the checkbox is first control in each row.
 
Share this answer
 
Use a checkboxlist control[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900