I have the following problem. When I remove a row in a RadGridView in a Master-Detail Form I get this error:
"It is not allowed to read or to write an instance marked for deletion."
This grid is linked to data as following way:
MyClass have a relation one to Many with MyClass2, MyClass.MyClass2 is a list implementing the relation
bindingSource1.DataSource = myContext.getAll<
bindingSource2.DataSource = bindingSource1;
bindingSource2.DataMember = MyClass2;
RadGridView.DataSource = bindinSource2;
context.getall<MyClass>() -> bindingSource1 -> bindingSource2 (DataMember = "MyClass2")-> RadGridView
I catch the bindingSource2.ListChanged event to remove the object from context:
sender, ListChangedEventArgs e)
(e.ListChangedType == ListChangedType.ItemDeleted)
And then, when I remove a row in the grid and after run this code the "It is not allowed to read or to write an instance marked for deletion." error is thrown.
I don't know what I'm doing wrong. Can anyone help me?
Thanks and sorry for my English
P.S. I attached a screenshoot of the error