We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting records using a data bound business object

Thread ID:





72998 Apr 15,2008 03:14 PM UTC Apr 24,2008 09:50 PM UTC WinForms 1
Tags: Grouping
James Evans
Asked On April 15, 2008 03:14 PM UTC

I have a very simple grouping grid and I would like the users to be able to delete records from the grid any only apply these deleted to the database when a save button is pressed.

To achieve this so far I have a BindingList as the data source where T is my business object. When the delete happens the record is deleted from the BindingList so now I don't know which record needs to be deleted.

I could probably get round this by detecting when a record is removed from the BindingList and then having another list to hold the deleted records but I was hoping there would be a more graceful way to achieve this standard problem.

Would you let me know the recommended way of dealing with this issue.

I am thinking there might be a way of flagging a record as having been deleted so it doesn't appear in the grid when the grid is refreshed but it's still in my BindingList so I can apply this to the database when the save button is pressed.

(I know that datasets can do this but I would like to use a business object is I can)


Sri Rajan [Syncfusion]
Replied On April 24, 2008 09:50 PM UTC

Hi James,

Thank you for your patience.

To achieve this behaviour you need to derive the BindingList class and Override RemoveItem method. In RemoveItem method, you need to store the deleted records information in a new BindingList. You can access these deleted record information using GetDeletedList method. Here are the code snippet.

public class MyBindingList : BindingList
BindingList list = new BindingList();
protected override void RemoveItem(int index)

//To get the deleted record list.
public BindingList GetDeletedList()
return list;

private void button1_Click(object sender, EventArgs e)
BindingList list = bl.GetDeletedList();
foreach (CustomClass obj in list)

Here is the sample code which implements this task.

Please let me know if this helps.

Best Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon