Here is my code
When I executed this code,it deleted the row (for the user). but internally it didn't. bcoz when I add another row , it gets added to the next row as if the deleted row still exists.
Could someone please answer how to get rid of this ?
Code:
public void DeleteItemRow(int currentRow)
{
tblOrderItemDetails.RowStyles.RemoveAt(currentRow);
for (int columnIndex = 0; columnIndex < tblOrderItemDetails.ColumnCount; columnIndex++)
{
var control = tblOrderItemDetails.GetControlFromPosition(columnIndex, currentRow);
tblOrderItemDetails.Controls.Remove(control);
}
for (int i = currentRow + 1; i < tblOrderItemDetails.RowCount; i++)
{
for (int columnIndex = 0; columnIndex < tblOrderItemDetails.ColumnCount; columnIndex++)
{
var control = tblOrderItemDetails.GetControlFromPosition(columnIndex, i);
if (control != null)
tblOrderItemDetails.SetRow(control, i - 1);
}
}
rowCount--;
tblOrderItemDetails.RowCount--;
}
Could someone please answer how to get rid of this ?