akshay rasalakar

akshay rasalakar

  • NA
  • 128
  • 9.4k

I want to update multiple records in repater using chekbox

May 16 2015 10:43 PM

        foreach (RepeaterItem item in rpt1.Items)
        {
            if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
            {
                CheckBox chk = (CheckBox)item.FindControl("chk_att");
                HiddenField hf_id = (HiddenField)item.FindControl("hf_id");

                if (chk.Checked == true)
                {

                    st = "Update tbl_member set Status='Attended' where MemberID=" + hf_id.Value + "";
                    x = db.ExeQuery(st);
                    if (x > 0)
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "<script>alert('Atteneded')</script>", false);
                        fillrpt();
                    }
                    if (chk.Checked == false)
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "<script>alert('Not Atteneded')</script>", false);
                    }
                }

but im getting error in foreach loop Collection was modified; enumeration operation may not execute.


Answers (2)