Hi Truong Giang,
Thank you for contacting Syncfsuion support.
Can you please share us below things?
1. Stack trace of the exception details
2. Syncfusion product version
It will help us to investigate further and provide appropriate solution at earlier.
Regards,
Vijayarasan S
I am facing the same issue. Do you get any solution to this?
Hi Anmol Gupta,
We suspect that the reported problem occurs due to adding and removing the
records continuously to the underlying collection. Based on our control
architecture, painting will be triggered while adding/removing the items to the
DataSource. At some point in your application, the removal of the record is performed
before completing the painting and ensuring the previously added record. In
such case the record count in the view and the items count in the underlying
DataSource will be mismatched. This leads to accessing the record using some
invalid index which causes the ArgumentOutOfRangeException.
However, you can resolve the reported problem by calling SfDataGrid.BeginInit() method before adding/removing an item and called
SfDataGrid.EndInit() method after adding/removing an item from the underlying
collection. This resolves the exception. But it will suspend/resume the
DataGrid process while adding/removing the items. Refer to the below code snippet,
// Batch Updates
//Suspends data manipulation operations in View SfDataGrid.BeginInit();
// Add, remove, and update the underlying collection.
//Resumes data manipulation operations and refresh the View. SfDataGrid.EndInit(); |
UG Link: https://help.syncfusion.com/windowsforms/datagrid/databinding#sourcecollectionchanged
Regards,
Vijayarasan S
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.