Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > How to manage delete operations on a Datagridview when binding with custom business objects?
 

How to manage delete operations on a Datagridview when binding with custom business objects?


I have implemented the INotifyPropertyChanged Interface for my class.
I am able to handle insert and update operations. But when a user deletes a row, as per .NET Architecture the ListChanged event gets fired after the value is deleted from the source object.

Now how do get to know that what row was deleted if I need to update the database based on delete operation?

Well.. maintaining another list and then comparing the can be a solution, but I think it would be a bad solution..
so.. any help is welcome..

Thanx.
_Kalesh_  Friday, August 08, 2008 6:00 PM
The datagridview's UserDeletingRow event fires just before the row is deleted. I would get the info you need about the row in this event.

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.userdeletingrow.aspx
Ken Tucker  Friday, August 08, 2008 6:44 PM
The datagridview's UserDeletingRow event fires just before the row is deleted. I would get the info you need about the row in this event.

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.userdeletingrow.aspx
Ken Tucker  Friday, August 08, 2008 6:44 PM
Thanx !
_Kalesh_  Saturday, August 09, 2008 5:06 PM

You can use google to search for other answers

Custom Search

More Threads

• DataBinding Problem?
• DataGridViewComboBoxCell conditional dropdown displaying ValueMember not Displaymember
• How to begin editing of a DataGridView cell on click?
• How to refresh ComboBox's DataSource?
• drag & drop listBox whith data source ???
• the binded DateTimePicker don't save the date into the database
• How do I stop DGV syncing to Proposed versions of rows
• gridview boundfields vs autogenerated columns
• DataGrid1_DoubleClick Event
• Enabling/disabling datagridview depending on datasource values