GridComboBoxColumn datasource rebinding issue

I am using an SfDataGrid with a GridComboBoxColumn. When I first bind the data to the grid and the combobox everything is fine. I then have a need to rebind both with a different datasource. The structures of the new datasources match the exact same structure as the original datasources. The valuemember of the combobox is named "TableName".

When I do this, this error occurs:

System.ArgumentException: Column 'TableName' does not belong to table Table.
   at System.Data.DataRow.CheckColumn(DataColumn column)
   at System.Data.DataRow.get_Item(DataColumn column, DataRowVersion version)
   at Syncfusion.WinForms.DataGrid.GridComboBoxColumn.GetFoundValue(IEnumerable enumerableSource, String valueMember, Object item)
   at Syncfusion.WinForms.DataGrid.GridComboBoxColumn.FindSelectedItem(Object dataSource, String valueMember, String value)
   at Syncfusion.WinForms.DataGrid.GridComboBoxColumn.GetFormattedValue(Object record, Object value)
   at Syncfusion.WinForms.DataGrid.Data.DataGridItemsPropertiesProvider.GetFormattedValue(Object record, String propName)
   at Syncfusion.WinForms.DataGrid.GridHandler.ShowToolTip(DataRowBase dataRow, RowColumnIndex rowColumnIndex, Point cursorPosition)
   at Syncfusion.WinForms.DataGrid.GridHandler.OnMouseMove(Object sender, MouseEventArgs e)
   at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
   at Syncfusion.WinForms.Controls.SfScrollControl.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at Syncfusion.WinForms.Controls.SfScrollControl.WndProc(Message& msg)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

9 Replies

TI Tim May 24, 2022 08:42 PM UTC

Here is the code where I do the bind and the rebind: 



var tablesCombo = (GridComboBoxColumn)tablesGrid.Columns["Name"];
tablesCombo.MappingName = "Name";
tablesCombo.ValueMember = "TableName";
tablesCombo.DisplayMember = "TableName";

tablesGrid.DataSource = _database.Tables;
tablesCombo.DataSource = tables;


VS Vijayarasan Sivanandham Syncfusion Team May 25, 2022 03:30 PM UTC

Hi Tim,

We are currently checking your reported issue with provided information and we need two more business days to validate this. We will update you with further details on May 27, 2022.

We appreciate your patience until then.


Regards,

Vijayarasan S



TI Tim May 25, 2022 05:39 PM UTC

Thank you and much appreciated. I have built you a sample that demonstrates the issue. To use it you will need a form with an SfDataGrid named "tables", and a button with the default name. I have attached the form and designer to make it easier.


Attachment: Form1_e5bf36c7.zip


VS Vijayarasan Sivanandham Syncfusion Team May 26, 2022 11:52 AM UTC

Hi Tim,


We have created a bug report for the reported issue “System.ArgumentException occurs while changing the DataSource at runtime in GridComboBoxColumn”. We will fix this issue and include it in our upcoming Weekly NuGet release scheduled for June 14, 2022.

You can track the status of this report through the following feedback link,

Feedback Link: https://www.syncfusion.com/feedback/35223/system-argumentexception-occurs-while-changing-the-datasource-at-runtime-in

Note: The provided feedback link is private, and you need to login to view this feedback.

We appreciate your patience until then.

Regards,
Vijayarasan S



TI Tim May 26, 2022 01:41 PM UTC

Shukria Vijay.



VS Vijayarasan Sivanandham Syncfusion Team June 14, 2022 01:57 PM UTC

Hi Tim,

Weekly NuGet was not released today due to an issue in the NuGet server machine. The NuGet package will be published tomorrow (June 15th, 2022).


We will let you know once it is released. 

Regards,

Vijayarasan S



VS Vijayarasan Sivanandham Syncfusion Team June 15, 2022 06:56 AM UTC

Hi Tim,


We would like to let you know that Essential Studio Weekly NuGet packages (v20.1.0.60) has been published in nuget.org with the fix for the issue “System.ArgumentException occurs while changing the DataSource at runtime in GridComboBoxColumn”. Please let us know if you have any concerns in this.

Regards,
Vijayarasan S



TI Tim June 24, 2022 01:23 PM UTC

Thank you, works as expected now.



VS Vijayarasan Sivanandham Syncfusion Team June 24, 2022 01:27 PM UTC

Hi Tim,

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.


Regards,

Vijayarasan S


Loader.
Up arrow icon