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.FindByV alue("x");
if(objListItem != null)
{
objListItem.Selected = true;
}
This code used to work until the datasource gave me parent/child checkboxes
-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.FindByV
if(objListItem != null)
{
objListItem.Selected = true;
}
This code used to work until the datasource gave me parent/child checkboxes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
foreach(ListItem li in chkLst.Items){if(li.Value=="x") li.Selected = true;}