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 Reply Children
No Data