According to the documentation, this event is only fired when the control that is bound to the DataSource changes the DataSources data, not when the DataSource data is changed directly by code.
I need an event that will fire even when the data is changed by code. Is there a way I can do that? Can I define my own event? How can I do that?
I'm not sure I understand what you are asking. When you say "DataSource" are you talking about the local object that holds the data, or the back end (the database)? It sounds like you are talking about the back end. In which case, I don't think there's any way to get a notification that the data changed in DotNet. But I suppose it depends on the DataBase you are using.
If you are talking about the client-side object, then what are you using as your data source? No matter what the data source is, it doesn't seem like you would need an event to fire. If the data changes, it's because your code changed it - either by going out to the database to get the data or because you changed it programatically. So you don't need an event, you could just add code to wherever your code is changing the data.
I need the event on the DataSource, not the grid.
My situation is as follows:
I have a "mother" DataSource (unconnected to any grid) which contains the data in a manner that reflects the data's true structure. However, I need to show the data in 2 totally differently structured ways. So I've created 2 grids connected to 2 OTHER "child" DataSources, which are structured to reflect the best way to display the data in their individual grid.
When I load the form, I populate the "mother" DataSource, and then populate the 2 "child" DataSources.
However, I have data coming in from a Web Service which changes the data in the "mother" DataSource. That data change needs to be reflected in the 2 "child" DataSources.
I am ready to write a subroutine to do that "updating", but I need an event on the "mother" DataSource that fires off whenever data changes so I can know to call my subroutine to update the 2 "child" DataSources.
Any suggestions?
If there is such an event, it would have to exist on the data source, not on the grid. The grid is not the source of the change when you change a value in the data source via code. In such a case, the grid responds to the event, so there's no reason for it to fire an event.
What exactly do you need to do in response to this change. If you want to do something to the grid row or cell, then perhaps you should be using the grid's InitializeRow event.