I have a repeater that have a button in every row, button will add some data records into datatable, so if I click that button in every row it will add more records to the datatable. I have a delete button in every row that should delete the records added from the same repeater row, so only records added from this row should be deleted. my code works fine except that it is deleting all records from the datatable. how to make delete specific records added from specific row?
my code:
for (int i = GRX.Rows.Count - 1; i >= 0; i--)
{
DataRow dr = GRX.Rows[i];
if (lbl4.Text == "2" || lbl4.Text == "4")
{
dr.Delete();
}
}
I have a sequence number in the repeater, so I have added the sequence in every record added to the datatable and added it to the the if statement.
the altered code is: