Hi Hajer,
Thanks for using Syncfusion products.
By default, the changes will be reflected in the underlying data source of the grid whenever the records in the grid is modified or deleted. From your code part we suspect that you want to retrieve the index of selected records. In order to get the index of the record, the IndexOf() method of UnsortedRecordsCollection can be used. We have created a simple sample as per your requirement and please make use of the below code and sample,
Code example:
|
//Event customization
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
//To delete the selected records
if(this.gridGroupingControl1.Table.SelectedRecords.Count > 0)
{
Record record = this.gridGroupingControl1.Table.SelectedRecords[0].Record;
//Index of the record in data source
int index = this.gridGroupingControl1.Table.UnsortedRecords.IndexOf(record);
MessageBox.Show(index.ToString());
}
this.gridGroupingControl1.Table.SelectedRecords.DeleteAll();
} |
If still the issue exists, please provide stack trace of the exception.
Regards,
Arulpriya