Problem deleting last row if grid table summary is present


Hi,

I'm using v 18.4.0.30 with VS 2019.
I've attached a sample project to test the behavior.
  • I attach an Observablecollection to sfDataGrid DataSource. everything works fine
  • At button click I delete the current row: everything works fine if table summary is not used. If table summary is used, works fine in every row but not with the last row in the grid
See the sample project.
  • try to delete row id 1: good


  • Now, try to delete row id 4


Application crashes at Program.cs:

System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index'

Maybe I'm doing something wrong?

Thanks in advance





Attachment: SfGridText_4a47ff18.zip

1 Reply 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team February 23, 2021 01:34 PM UTC

Hi Manuel, 

Thanks for contacting Syncfusion products.  

You can resolve this by using SfDataGrid.DeleteSelectedRecords() and enabling SfDataGrid.AllowDeleting property to delete the selected row as shown below.  

Code example :  

private void button1_Click(object sender, EventArgs e) 
{ 
    DataGridControl.DeleteSelectedRecords(); 
} 




Please let us know if you require further assistance from us.  

Regards, 
Mohanram A. 


Marked as answer
Loader.
Up arrow icon