Click here to Skip to main content
11,484,528 members (66,624 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET ADO.NET
I have a checkboxlist having some items in it ..
I had also added an item in it..
Now I want to do like this... that
when i check the item having name then all the other checkboxlist items get unchecked ...
Plzzz help me out
Posted 7-Mar-11 16:01pm
Edited 25-Jul-12 0:31am
v2
Comments
gracia8xx at 25-Jul-12 5:16am
   
post your code.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,

you need to use loop to uncheck all the items.
foreach (ListItem li in checkboxlist.Items)
        {
            li.Selected = false;
        }
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Have you tried anything. It is simple.

Attach a javascript to the list item like this

CheckBoxList1.Items[2].Attributes.Add("onclick", "unCheckCheckList('" + CheckBoxList1.ClientID + "', '*')");

In the javascript clear the check

function unCheckCheckList(table, sel_value) {
        var tableElement = document.getElementById(table);
        var children = tableElement.getElementsByTagName("input");
        for (i = 0; i < children.length; i++) {
            if (children[i].value != sel_value) {
                children[i].checked = "";
            }
        }
}
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

please find childer of type checkbox and assign checkmark in it.
  Permalink  
Comments
Sandeep Mewara at 25-Jul-12 5:32am
   
Why opening a 1.5 yr old question and suggesting something which is not right either!

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

  Print Answers RSS
0 Maciej Los 190
1 Sergey Alexandrovich Kryukov 170
2 Raje_ 155
3 OriginalGriff 147
4 Mehdi Gholam 120
0 Sergey Alexandrovich Kryukov 8,484
1 OriginalGriff 7,948
2 Sascha Lefèvre 3,199
3 Maciej Los 2,681
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 25 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100