Link to home
Start Free TrialLog in
Avatar of Akiren
Akiren

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
foreach(ListItem li in chkLst.Items){if(li.Value=="x") li.Selected = true;}