ramesh s

ramesh s

  • NA
  • 116
  • 9.3k

Checkboxlist deselect item

Nov 10 2017 7:47 AM
Hi All,
 
 
I  have populating checkboxlist with database at runtime, it contains Group/Sub Group items. When selected Group item Sub Group item also to be select.  Group and Sub Group items have first 7 characters are similar, using below logic it is working .
 
string vals = ""; 
string val = ""; 
foreach(Listitem item in chklist.items)
{
   if (item.Selected)
   {
         if(Group)
         {
             vals += strGroup;
         } 
   } 
foreach(Listitem item in chklist.items)
{
   if(SubGroup)
    {
          val= item.value;
         if (val.Contains(vals)
         {
               item.selected = true; 
         } 
    } 
 
 
As per requirement user also can deselect Sub Group. with the above logic always subgroup is selected if group selected. Please suggest me even group selected sub group able deselect it.
 
Thanks 
 
 
 

Answers (1)