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
135
Getting exception while iterating HeaderCell in XAMGrid
posted

Hi,

I have been using Xamgrid in my application and recently we were adding support for multi level checkbox selection for the items in the grid.

Regarding the same we needed to iterate our HeaderCell to remove the checkbox state.

But when i am iterating the HeaderCell in our grid i keep on getting exception in the code below. 

       foreach (CheckBoxHeaderCell headerCell in headerCells)
         {
            if (headerCell != null)
            {
               bool? state = null;
               int checkedRowsCount = 0;
               if (headerCell.Row.Manager.Rows != null)
               {
                  foreach (Row row in headerCell.Row.Manager.Rows)
                  {
                     if (row.Data is ICheckable && (row.Data as ICheckable).IsChecked)
                     {
                        checkedRowsCount++;
                     }
                  }
               }


I get the exception on the line "foreach(Row row in headerCell.Row.Manager.Rows)"

The exception i get is "Object reference not set to an instance of object".

Below is the stack trace for the exception please let me know if you could suggest something regarding what could be wrong and why xamgrid is throwing the exception.

at Infragistics.Controls.Grids.RowsManager.SetupDataManager()

   at Infragistics.Controls.Grids.RowsManager.EnsureDataManager()

   at Infragistics.Controls.Grids.RowsManager.get_DataManager()

   at Infragistics.Controls.Grids.RowsManager.get_DataCount()

   at Infragistics.Controls.Grids.RowsManager.Infragistics.IProvideDataItems<Infragistics.Controls.Grids.Row>.get_DataCount()

   at Infragistics.Collections.BindableItemCollection`1.GetCount()

   at Infragistics.Collections.CollectionBase`1.get_Count()

   at Infragistics.Collections.CollectionBaseEnumerator`1.System.Collections.IEnumerator.MoveNext()

Parents Reply Children
No Data