The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi,
I've been evaluating the Grid, and have come across this problem...
the attached app has a standard 10 row x 2 col GridControl; see Form1.cs for the source code...
1st column has ComboBox type cells, using a choice list (i.e. StringCollection).
2nd column has ComboBox type cells using an ArrayList as a DataSource.
It's a very simple application, but when I run it, there is a problem with the first column's combo box items getting corrupted.
To reproduce:
1. Click on any cell in column 1 (A), the combo looks OK.
2. Click on any cell in column 2 (B), this looks OK.
3. Now click on any cell back in column 1; the combo box is corrupted.
I generated the app in design mode and added some extra code to the form's constructor, as well as the class "DescriptionValuePair" to hold the ArrayList objects for the DataSource...
Am I doing anything wrong? I can't see anything wrong in the 20 or so lines of code.
Thanks,
Harvey Green
CBClay Burch Syncfusion Team September 12, 2002 07:51 AM UTC
Normally, Essential Grid uses the same combobox for all cells with celltype COmboBox in a grid. Then as you move from one combobox cell to another combobox cell, the choicelist (or DataSource depending upon which you are using) is swapped out to reflect the settings of a new cell. The problem you are seeing is when you try to swap a combobox cell using a choicelist with a combobox cell using a DataSource. As you see, this does not work.
But the solution is simple. Just have two combobox cell models, one for choicelists and one for DataSources. You use the GridControl.CellModels.Add method to add this second celltype. For example in your code, if before you try to setup column 2, you add
this.gridControl1.CellModels.Add("ComboBoxDS", new GridComboBoxCellModel(this.gridControl1.Model));
this registers a new celltype named ComboBoxDS that is just another combobox cell. You can then use ComboBoxDS as the celltype for column 2, and I think the problem you are seeing goes away.
One last comment. You can use the same comboboxes for different choicelists. So, for example if you add a col 3 that is similar to your col 1, but with a different string collection but the same ComboBox celltype, everything would work OK. Or, if you add another ComboBoxDS column but with a different DataSource, everything would be OK. The problem is trying to mix using choicelists and Datasource in a single combobox.
HGHarvey GreenSeptember 12, 2002 10:19 PM UTC
Hi Clay,
Thanks for that - it works fine now...
it would be good if this was mentioned in the user guide section on combo boxes
Regards,
Harvey