Hello, please i need your help,
I have a RadGridView and the rows have different types, for example: Type A, Type B, .... and sometimes there is a relation between rows, and if a user try to delete a row (for example row A) I check if there is a relation between the row that the user want to delete (row A) and all the rows of the RadGridView, and if there is a relation I propose to the user if he want to delete the row (Row B for example) (or rows) who the row A have a relation.
I used the event RowsChanging to get the index of the rows that the user wants to delete, like this, and then I can delete the rows who have a relation with the row A.
private void radGridView_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Remove) // The Action is to delet the row A
{
// if(I check if row A have a relation with another row)
{
//i delet this rows
radGridView .Rows.RemoveAt(indexoftherowiwanttodelet);
}
}
}
My problem is:
If the index of the row A is smaller than the index of the row B, the code works very well.
But if the index of the row A is bigger than the row B, I have an exception:
'System. ArgumentOutOfRangeException' occurred in mscorlib.dll
I need your help and thank you.