Hello, I have the following code to delete selected items from repeater. I get the following error when the code is excecuted:
"System.InvalidOperationException: Collection was modified; enumeration operation may not execute."
and here is my code:
protected void btnDeleteSelected_Click(object sender, EventArgs e)
{
foreach (RepeaterItem dataItem in rptCart.Items)
{
if (dataItem.ItemType == ListItemType.Item || dataItem.ItemType == ListItemType.AlternatingItem)
{
// find checkbox in repeater
CheckBox chkRows = (CheckBox)dataItem.FindControl("chkRows");
if (chkRows != null && chkRows ...
Go to the complete details ...