Hi Neagoe (and Alexander)....
I think the problem lies within how the object that is also a part of the list if removed delete... because:
try
{
PersistentObject ObjSelectedForDelete = MyGrid.CurrentRow.DataBoundItem
as
PeristentObject;
Context.Delete(ObjectSelectedForDelete);
Context.SaveChanges();
RefreshData();
}
The above code only deletes the object... However, depending on how this is mapped (see my other thread), you might need to remove it from the list too.... I usually use the pattern 1) Remove it from the list 2) Remove the object itself if it is an unmanaged 1:n which is the default now I guess.
Update:
So basically what needs to be added is:
The "owner" object (say OwnerObject) of the list of persistent types... has a property with the list... say MyList... So you need to do a OwnerObject.MyList.Remove(ObjectSelectedForDelete); // Corresponding to step 1 above
Context.Delete(ObjectSelectedForDelete); // Corresponding to step 2 above
Regards
Henrik