Cannot delete entity in grid?

Posts   
 
    
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 25-Aug-2005 16:33:32   

I'm using .Net 2.0, using the adapter model to write a win app. I've an entity collection bound to a DataGridView, when I select the row by row selector and press delete key to delete the row, but it has no response, the row is not deleted. Entity collection des not support delete operation?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 26-Aug-2005 10:38:05   

Set entityCollection.AllowRemove to true, it's false by default. After you've done that, the bound control will see that IBindingList.AllowRemove (set it before binding to the control) is returning true, and will allow you to delete elements from the collection.

Frans Bouma | Lead developer LLBLGen Pro
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 26-Aug-2005 14:03:17   

I set AllowRemove to true, it works fine now. I want to know any reasons behind for setting AllowRemove to false as default, while true for AllowEdit and AllowNew? Thanks smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 26-Aug-2005 15:57:35   

Barry wrote:

I set AllowRemove to true, it works fine now. I want to know any reasons behind for setting AllowRemove to false as default, while true for AllowEdit and AllowNew? Thanks smile

Well, you have to pick one: true or false, as the default simple_smile . If I would have chosen true, all people who don't want delete functionality would need to set it to false and vice versa. I think deletes are pretty intense too for the object graphs bound to the grids, as an undo is not that easy to do, that's why I set it to false, so it's not accidentily slipped into an application which then goes into production and some user calls at 11 PM on a friday "Odd, when I press Del on a row, it is gone, how do I get it back?" wink

Frans Bouma | Lead developer LLBLGen Pro