I've searched hi/lo and found many similar posts but those answers aren't working for me.
I've got a FormView, in an UpdatePanel. In the FormView's EditItemTemplate and InsertItemTemplate I'm using both a CheckBox and a CheckBoxList. To present the data I databind in the code behind, (but then have to iterate to mark selected). There I cast the sender as CheckBoxList in the OnPreRender event and use that object.
The problem is retrieval. I'm trying to access the user's entries when they submit by using the cast. It is working fine for the CheckBox, but for the CheckBoxList the resulting checkboxlist object doesn't have any items.
Here, both active and roles are created (they're not 'null') and active has the expected 'name' and 'selected' values, but roles has an item count = 0 and the for loop isn't entered.
CheckBox active = ((CheckBox)Emp_Form.FindControl("cbActive"));
CheckBoxList roles = (CheckBoxList)Emp_Form.FindControl("UsrRoles");
foreach (ListItem role in roles.Items)
// do stuff
Is there another way to cast a checkboxlist? Any help would b
View Complete Post