0

Please help me why my selected item not deleted from grid-view in c#.

Code:

rowindex = this.AB.ABProducts.Count - 1;

foreach (GridViewRow row in gc.GridRows)
{
    CheckBox chkRow = row.Cells[2].FindControl("chkID") as CheckBox;
    {
        if (rowindex >= 0)
        {
            if (chkRow.Checked)
            {

                this.AB.ABProducts.Remove(rowindex);
            }
        }
    }
    rowindex--;
}

0 Answers0