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
1440
Exception: BindingSource cannot be its own data source
posted

Hi,

I am getting this exception once a while when I am trying to change the cell value by calling SetCellValue from UltraDataRow object.

 ((UltraDataRow)arg.Cell.Row.ListObject).SetCellValue(arg.Cell.Column.Key, arg.Value);

 

This is how I set the DataSource:

MainGridDataSource source = new MainGridDataSource(columns, holdingList, "Main");
BindingSource bindingSource = new BindingSource(source, null);
this.ultraGrid1.SetDataBinding(bindingSource, null, false, false);

"Main" is the name of my top band.

 

Please help.. Thanks!

 Jason Ching 

 

Message: System.InvalidOperationException: BindingSource cannot be its own data source. Do not set the DataSource and DataMember properties to values that refer back to BindingSource.
   at System.Windows.Forms.BindingSource.get_Count()
   at Infragistics.Win.UltraWinGrid.RowsCollection.InternalGetListObjectForRow(UltraGridRow row)
   at Infragistics.Win.UltraWinGrid.RowsCollection.get_Data_List()
   at Infragistics.Win.UltraWinGrid.RowsCollection.get_ResolvedDataList()
   at Infragistics.Win.UltraWinGrid.RowsCollection.OnListChangedHelper(ListChangedEventArgs e, Boolean calledFromBandListChanged)
   at Infragistics.Win.UltraWinGrid.RowsCollection.OnListChanged(Object sender, ListChangedEventArgs e)
   at Infragistics.Win.UltraWinDataSource.UltraDataRowsCollection.FireBindingList_Helper(ListChangedType changeType, Int32 index, PropertyDescriptor propertyDescriptor)
   at Infragistics.Win.UltraWinDataSource.UltraDataRowsCollection.FireBindingList_ItemChanged(UltraDataRow row, UltraDataColumn column)
   at Infragistics.Win.UltraWinDataSource.UltraDataRow.SetCellValue(UltraDataColumn column, Object value, Boolean throwInvalidColumnException, Boolean fireCellUpdateEvents)
   at Infragistics.Win.UltraWinDataSource.UltraDataRow.SetCellValue(UltraDataColumn column, Object value, Boolean raiseCellUpdateEvents)
   at Infragistics.Win.UltraWinDataSource.UltraDataRow.SetCellValue(String columnKey, Object value, Boolean raiseCellUpdateEvents)
   at Infragistics.Win.UltraWinDataSource.UltraDataRow.SetCellValue(String columnKey, Object value)

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

     Hi Jason,

    That's a really weird error and I can't imagine why it's occurring. But the line of code you have here seems pretty convoluted. What event are you calling this in?

    ((UltraDataRow)arg.Cell.Row.ListObject).SetCellValue(arg.Cell.Column.Key, arg.Value);

    Anyway, this line of code starts with a cell and then jumps through all sorts of hoops to set the value on the same cell it started with. You could just as easily do this and it would be the same thing:

    arg.Cell.Value = arg.Value;

     

Children
No Data