Click here to Skip to main content
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 George Jonsson 175
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 25 Jul 2012
Copyright © CodeProject, 1999-2014
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