I have a checkboxlist control that is bound to an IEnumerable list.
I added an @ref parameter to the CheckBoxList markup to point it towards a declared variable "MyCheckBoxList"
I want to be able to iterate through the list, and disable items that have been checked.
foreach (var citem in MyCheckBoxList.Items)
{
if (citem.Value.ProductItemId == pitem.ProductItemId)
{
citem.Disabled = true;
}
}
However, when I try to do that, I get errors about the CheckBoxList being a RenderFragment, and therefore I can't access the Items list.
|Error|CS1579|
foreach statement cannot operate on variables of type 'RenderFragment' because 'RenderFragment' does not contain a public instance or extension definition for 'GetEnumerator'
What is the workaround?
TIA,
Miles