I sometimes use the Infragistics control suite. In specifically, I will utilize their grid control in my projects. This is one of the best grids out there, but it has some gotchas. One of the issues that commonly arise with this control deals with committing data to the DataSource (database, XML, etc...).
Example:
- I drop a grid on a windows forms UserControl
- In the load event of the UserControl I bind my data
- I drag the UserControl on to a form
- I update the properties to allow user to edit data in the grid per requirements
Now the issue with this is, when the user selects the 'X' on the main form the controls on the form will start to dispose. So none of the databinding events fire on the grid to update the DataSource that the grid is bound to. So, if you call Update(); on your table adapter. The RowState of the rows have not been changed and nothing will persist to the database.
Fix:
- Develop your UserControl as normal or as basically described above
- Expose the grid as a public object on your UserControl
- On the containing form's closing event call the grid's UpdateData() method to force all user changes to the DataSource of the grid control
- Call update on the table adapters or whatever persisting method you utilize to save data to your persistent store.
Hope this helps someone out.