Click here to Skip to main content
12,395,645 members (76,839 online)
Rate this:
 
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 15:01pm
Updated 24-Jul-12 23:31pm
v2
Comments
gracia8xx 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 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
Top Experts
Last 24hrsThis month


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