views:

447

answers:

2

I have a winforms application that i added a DataGridView bound to a subsonic collection via a BindingSource to it.

The grid works fine for adding/editing (except for the display of the ComboBox column) but i can't get it to delete rows correctly from the database.

If i delete a row from the DataGridView, i can't problematically determine that the collection is dirty. and when i call the .BatchSave method of the subsonic collection it deletes all the rows.

any suggestions?

Thanks Tony W

+1  A: 

Just do this:

private void productBindingSource_ListChanged(object sender, ListChangedEventArgs e)
{
    ((ProductCollection)productBindingSource.List).SaveAll();
}
P a u l
+1  A: 

In the 2.2 version SaveAll should also delete the items you removed from your datagridview.

In 2.1 you have to make a call to

ItemCollection.ProcessDeletedItems()

too

SchlaWiener