Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
785
Adding a new row through our collection does not fire the AfterRowInsert event
posted

Hi,

When adding a new row to our collection (of type IBindingList), the AfterRowInsert event does not fire event if we send the following notification after the record is added to the collection:

OnListChanged(ListChangedType.ItemAdded, TargetCount-1);

We do see the new row in the grid. The problem is that we would like to perform some actions when adding a new row to the grid and AfterRowInsert is does not seem to be working.

What have we missed?

As always, thank you in advance.
Annie

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

     Hi Annie,

        This is correct. AfterRowInsert fires to let you know when the user has added a new row. If you are adding the new row in code or if it is occurring as the result of some other action, then you already have a way of determing that it happened, and you don't need a grid event to tell you so.

        You should probably trap the ListChanged event of your data source and use that. Or perhaps expose another event on your data source to indicate after the row has been added.  

Children