Hi,
I have a single xamwebgrid. I am getting data from different table on button click, since datasource is changing at run time so I am adding columns using code xamwebgrid.columns.add().
When I bind the data first time everything is working fine, but as I bind the grid with other datasource (or with the same datasource), xamwebgrid.columns.add() throw NullReferenceException with message "Object reference is not set to an instance of object" and stacktrace is as follow:
at Infragistics.Controls.Grids.RowsManager.InvalidatePager() at Infragistics.Controls.Grids.RowsManager.InvalidateData() at Infragistics.Controls.Grids.RowsManagerBase.OnColumnLayoutPropertyChanged(ColumnLayout layout, String propertyName) at Infragistics.Controls.Grids.RowsManager.OnColumnLayoutPropertyChanged(ColumnLayout layout, String propertyName) at Infragistics.Controls.Grids.XamGridRowsManager.OnColumnLayoutPropertyChanged(ColumnLayout layout, String propertyName) at Infragistics.Controls.Grids.RowsManagerBase.OnColumnLayoutPropertyChanged(Object sender, PropertyChangedEventArgs e) at Infragistics.DependencyObjectNotifier.OnPropertyChanged(String propertyName) at Infragistics.Controls.Grids.ColumnLayout.InvalidateData() at Infragistics.Controls.Grids.ColumnBaseCollection.AddItem(Int32 index, ColumnBase item) at Infragistics.Collections.CollectionBase`1.Add(T item) at SBOSLCollection.Grid.EntityClass.GoodReciptPoListData.AddColumns()
My code to rebind the datagrid and add columns is as follow:
grid.ItemSource=null;
grid.Columns.Clear();
BaseColumn column= new TextColumn();
column.headerText="Title Column";
column.key="ColumnKey";
grid.columns.add(column); //Here Nullreference exception is throw.
One more thing i want to add with above issue.
I have Infragistics Silverlight control 10.1 release and every thing is working fine with this. But as i upgrage Infragistics Silverlight controls 10.2 release above mention error is occuring.
I tried to reproduce this issue with the 10.2 release and both Service Releases that have since been released. But with no luck.
Do you have a simplified sample that shows the issue?
Thanks,
-SteveZ
Hi Stephen,
I tried to resolve the error and I find the following things :
1) This error occure if paging is enabled.
2) xamgrid.ItemSource=null is not worked. Even after assigning a null reference ItemSource show the old itemSource.
So for the time being I reinitialize the instance of xamgrid to run my application without error.
I hope you considering the above finding related to error.
I try to provide you some simplified sample code.
Yes actually the sample i made to try and reproduce it i already had paging turned on. So if/when you have time a simplified sample would be great.
-steveZ