CheckBoxList Child controls

I have a checkboxlist populated by a datasource which creates a toplevel category and child elements like such
-Car
---Dodge
---Chevy
---Pontiac

How do I access the "selected" feature of the individual items? Before the datasource was adding a child list this worked

ListItem objListItem = CheckBoxList.Items.FindByValue("x");

if(objListItem != null)
{
objListItem.Selected = true;
}

This code used to work until the datasource gave me parent/child checkboxes
AkirenAsked:
Who is Participating?
 
Obadiah ChristopherConnect With a Mentor Commented:
foreach(ListItem li in chkLst.Items){if(li.Value=="x") li.Selected = true;}
0
 
Obadiah ChristopherCommented:
foreach(ListItem li in chkLst.Items){if(li.Value=="x") li.Selected = true;}
0
 
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.