Hi,
I have a grid that i am populating Programmatically. I create the Columns and add them in code. I have changed the edit type of one of the columns to use a combo box. Everything works cool and the grid loads and the combo box on the cell is populated. The problem comes in when selecting a value in the combobox. That selected value updates not only the current cell, butt all cells of the column in the other rows.
P.S.
It seems like it updates all cell with a similar value before the change.
If anybody can help with this i would be every gratefull. I have been trying to sort this problem out for the last week.
Below is the code in my app.
DataGridResults.AutoGenerateColumns = false;
GridViewDataColumn columnID = new GridViewDataColumn();
columnID.DataType = typeof(string);
columnID.UniqueName = "ID";
columnID.DataMemberPath = "ID";
columnID.HeaderText = "ID";
columnID.IsVisible = false;
GridViewDataColumn columnBarcode = new GridViewDataColumn();
columnBarcode.DataType = typeof(string);
columnBarcode.UniqueName = "Barcode";
columnBarcode.DataMemberPath = "Barcode";
columnBarcode.HeaderText = "Barcode";
GridViewDataColumn columnStatus_ID = new GridViewDataColumn();
columnStatus_ID.DataType = typeof(string);
columnStatus_ID.UniqueName = "Status";
columnStatus_ID.DataMemberPath = "Status.Name";
columnStatus_ID.HeaderText = "Status";
columnStatus_ID.Width = new System.Windows.GridLength(200);
DataGridResults.Columns.Add(columnID);
DataGridResults.Columns.Add(columnBarcode);
DataGridResults.Columns.Add(columnName);
DataGridResults.Columns.Add(columnStatus_ID);
//Status Combo and Column
ComboBoxEditorSettings comboBoxEditorSettings = new ComboBoxEditorSettings();
Granite.Objects.Status _stat = new Granite.Objects.Status();
comboBoxEditorSettings.ItemsSource = _stat.GetAll(Granite.Objects.AppliesTo.LOCATION);
comboBoxEditorSettings.DisplayMemberPath = "Name";
comboBoxEditorSettings.SelectedValuePath = "Name";
((GridViewDataColumn)DataGridResults.Columns["Status"]).EditorSettings = comboBoxEditorSettings;
9 Answers, 1 is accepted
Hi Etienne,
I have been trying to reproduce the problem here, but with no success so far.
Can you please attach a project or a piece of code to help me reproduce the issue? What I need to know actually is the kind of data you bind to, the way you bind and the way you update the data.
Best wishes,
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
The code you provided populates each cell in the Status column with the same instance:
_listOfStatus[0]
So when you change it in one cell, the expected behaviour in this case is the other cells to update with the same value. The reason is that they are all displaying the same instance or in other words all the cells in the status column point to one and the same object in memory.
Best wishes,
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Please set
_columnStatus.DisplayMemberPath= "Status.Name"
and
_columnStatus.DataMemberPath = "Status"
I believe this will fix the trouble . The code above tells the RadGridView : "Display the name of the status , but update the whole status object rather than just the name".
Regards,
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Hi Etienne,
Please excuse me for the inconvenience caused. It seems I have tested with an internal build of the RadGridView. You are right - indeed the property mentioned is not available publicly available. We are clearing some problems with editors and the fixed version with the property available publicly will be shipped around April/08/2009 with the Service Pack Q1 release.
I understand that this issue may slow down or stop your project development , that is why I am sending a small sample to you. If you find the approach applicable to your scenario please use it till we ship the service pack . We will do our best to ease the implementation and make it achievable with just few lines of code.
*Please note that the data used to populate the combobox implements INotifyPropertyChanged. ( it is needed for the proper functioning of the update logic for the cell value).
Best wishes,
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Hello Etienne,
The latest build includes a new type of column - GridViewComboBox column.
It has the full set of "lookup" properties including DisplayMemberPath. I hope it will fit in your scenario.
Best wishes,
Pavel Pavlovthe Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.