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
947
Urgent! Please Help About InvalidCast Exception
posted

Hi,

 This is what I am doing.

I am binding my grid to BindingList (Flat).

But when the form loads, I apply a group by column, which was saved on layout. So basicallyl, I expect the grouping to be applied at this time, but expect that no rows or very few of them present.

Then, while it is populating the grid with rows from BindingList (which I assume...)

Then, I am getting the following exception on BindingList' ListChanged Event.

(From my code, I don't have any part that tries to convert UltraGridRow from UltraGridGroupByRow', and vice versa. The below exception simply happens when the grid is being populated by rows in BindingList).

Unhandled Thread Exception, Exception='System.InvalidCastException:

Unable to cast object of type 'Infragistics.Win.UltraWinGrid.UltraGridRow' to type 'Infragistics.Win.UltraWinGrid.UltraGridGroupByRow'.    at

Infragistics.Win.UltraWinGrid.RowsCollection.SyncRows_Add(UltraGridRow row, Int32 desiredIndex)    at

Infragistics.Win.UltraWinGrid.RowsCollection.OnListChangedHelper(ListChangedEventArgs e, Boolean calledFromBandListChanged)    at

Infragistics.Win.UltraWinGrid.RowsCollection.OnListChanged(Object sender, ListChangedEventArgs e)    at System.ComponentModel.ListChangedEventHandler.Invoke

(Object sender, ListChangedEventArgs e)    at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)    at

System.Windows.Forms.BindingSource.InnerList_ListChanged(Object sender, ListChangedEventArgs e)    at

OnListChanged(ListChangedEventArgs e_)

 

 Can you please tell me what is the cause of this? And, is there a specific setting that I need to set on Grid or on BindingList?

Parents
  • 37774
    posted

    I think that this issue has been recently fixed, though I don't think that it made it into the hotfix.  If I recall correctly, the issue had to do with applying sorting/grouping and filtering at once when there was already sorting or grouping enabled (though the latter might not be true).  Regardless, I'm not aware of any workaround short of applying the sorting/grouping and the filtering separately, allowing the grid to paint and reverify its rows in between the two.  You should contact Developer Support to see if this issue has been resolved, and be notified of the fix.

    -Matt

Reply Children