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
900
Null reference exception when adding SortedField
posted

Hi,

I have some code that loads settings for my grid.  The code is executed from within the OnFieldLayoutInitialized() method after my fields have been created.

When I attempt to add a FieldSortDescription to the SortedFields collection in my layout, I get a null reference exception.  Is there some pre-requisite for being able to do this? Maybe I'm missing something? Any ideas?

Thanks

   at Infragistics.Windows.DataPresenter.UnsortedRecordSparseArray.GetItem(Int32 index, Boolean create, Boolean calledFromSortedManagerSparseArray, Boolean& newRowCreated)
   at Infragistics.Windows.DataPresenter.UnsortedRecordSparseArray.GetItem(Int32 index, Boolean create)
   at Infragistics.Windows.DataPresenter.DataRecordCollection.get_Item(Int32 index)
   at Infragistics.Windows.DataPresenter.RecordManager.VerifySort()
   at Infragistics.Windows.DataPresenter.DataPresenterBase.OnProcessSortCriteria(FieldLayout fieldLayout)
   at Infragistics.Windows.DataPresenter.DataPresenterBase.OnSortCriteriaChanged(FieldLayout fieldLayout)
   at Infragistics.Windows.DataPresenter.FieldLayout.BumpSortVersion()
   at Infragistics.Windows.DataPresenter.FieldLayout.OnSortedFieldsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Infragistics.Windows.DataPresenter.FieldSortDescriptionCollection.RaiseCollectionChangedEvent(NotifyCollectionChangedEventArgs e)
   at Infragistics.Windows.DataPresenter.FieldSortDescriptionCollection.InsertItem(Int32 index, FieldSortDescription fsd)
   at Infragistics.Windows.DataPresenter.FieldSortDescriptionCollection.Add(FieldSortDescription item)