I am using CSLA 2.1.4. I have an EditableRootListBase collection bound to a DataGridView. Based on the user login the DataGridView is editable or readonly. The CanEditObject call works correctly and prevents edits for the readonly users, but the Save method on the root object is called every time I navigate to another row in the grid. How can I prevent trying to save when the user has readonly access? I have tried setting the grid to ReadOnly and that does prevent changing data but still when changing rows the bindingsource thinks it needs to call EndEdit, which calls Save which throws the "Cannot Edit" exception which pops up the message in my UI, not the best workflow for a user.
Thanks
Doug Cleven
You should be able to override SaveItem() in your collection class:
Public Overrides Sub SaveItem(ByVal index As Integer)
If MyCollectionType.CanEditObject() Then
MyBase.SaveItem(index)
End If
End Sub
Copyright (c) Marimer LLC