We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Problem with combo boxes

Thread ID:

Created:

Updated:

Platform:

Replies:

997 Sep 11,2002 11:02 PM Sep 12,2002 06:19 PM Windows Forms 2
loading
Tags: GridControl
Harvey Green
Asked On September 11, 2002 11:02 PM

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

Clay Burch [Syncfusion]
Replied On September 12, 2002 03:51 AM

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.

Harvey Green
Replied On September 12, 2002 06:19 PM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;