I'm wondering if anyone knows what might cause a NullReferenceException when setting a data source. I have a stack trace that shows the following:
at Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(Object newDataSource, String newDataMember) at Infragistics.Win.UltraWinGrid.UltraGridBase.set_DataSource(Object value) at MyApp.MyControl.set_LineItems(DataTable value)
The DataTable that we pass in is definitely not null. If someone can point in the right direction as to what might be wrong with the DataTable that would cause a NullReferenceException at this point.
I'm using version Infragistics 7.3.20073.1052 (I know it's no longer supported by Infragistics, and I'm also not the decision maker for purchasing an upgrade to the latest version, so that's why I'm asking here.)
It's generally a good idea to use the SetDataBinding method to set both DataSource and DataMember at the same time. That way you can issues where the DataSource and DataMember don't match up. It's also more efficient, since the grid binds in one atomic operation instead of two when you are changing both properties.
If that does not help, or if you are not using the DataMember, then my next guess is that the error is not really occurring where it seems to be occurring. It's possible that the real exception is occurring in some event of the grid and getting handled. This typically occurs in InitializeLayout or InitializeRow where your code is referring to a column or band that does not exist in the new data source. If that's the case, setting the Visual Studio IDE to break on all run-time exceptions will reveal where the exception is really happening.
If none of that helps, then it's possible this is a bug in the version of the grid you are using. In that case, you might want to try getting latest service release.
How to get the latest service release - Infragistics Community
We have upgraded to the latest service release and this doesn't seem to be happening anymore. Thanks.