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. Image for the cookie policy date
close icon

ComboBox selections dissapear when moving to other cells

Hi,
I have a bound combo box. The data loads but the initial display is always blank. I can select an item from the list, but if I click on another cell it disappears, although the list is still there. Can you help?

Thanks

7 Replies

AD Administrator Syncfusion Team December 8, 2006 09:14 AM UTC

Some things to check:

Do you see any exceptions listed in your output window when you do the steps you listed? If so, that might point out why the value is resetting.

Is the style.ReadOnly property for your combox cell set to true?

Are you handling some validation event (like CurrentCellValidating) and somehow cancelling the change?

Is the style.CellValueType setting consistent with the values you are trying to place into the cell from the Dropdown?

If this is a virtual GridControl, are you saving e.Style.Cellvalue into your datastore in SaveCellInfo and providing it back in QueryCellInfo?

If you cannot spot this problem, if you upload a sample showing it, we can try debugging it here.


AD Administrator Syncfusion Team December 8, 2006 03:02 PM UTC

Clay,
I checked all the settings you mentioned (including read only with both 'true' and 'false' and am still getting the same result. Here's the code I'm using:

GridBoundColumn operatorColumn = new
1) My Data Source

this.ds3 = new DataSet();
this.ds3.ReadXml("ComparisonOperators_2.xml");

2) Creating column and Adding to Collection
GridBoundColumn();
operatorColumn.HeaderText = "Apply Comparison Operators";
operatorColumn.StyleInfo.CellType = "ComboBox";
operatorColumn.ReadOnly = true; //false gives same results
operatorColumn.StyleInfo.CellValueType = typeof(string);

attributeColumns.Add(operatorColumn);
this.productGridGrouper.Binder.GridBoundColumns = attributeColumns;

3)Adding Choices to Combo Box

this.productGridGrouper.Binder.InternalColumns[2].StyleInfo.DataSource = this.ds3.Tables["Operator"];


There are no error messages nor any validation codes or event captures on that control.





>Some things to check:

Do you see any exceptions listed in your output window when you do the steps you listed? If so, that might point out why the value is resetting.

Is the style.ReadOnly property for your combox cell set to true?

Are you handling some validation event (like CurrentCellValidating) and somehow cancelling the change?

Is the style.CellValueType setting consistent with the values you are trying to place into the cell from the Dropdown?

If this is a virtual GridControl, are you saving e.Style.Cellvalue into your datastore in SaveCellInfo and providing it back in QueryCellInfo?

If you cannot spot this problem, if you upload a sample showing it, we can try debugging it here.


AD Administrator Syncfusion Team December 8, 2006 05:15 PM UTC

You need to set

operatorColumn.ReadOnly = false;

Also, you should set:
operatorColumn.DisplayMember = "SomeColumnName";
operatorColumn.ValueMember = "SomeColumnName";

where SomeColumnName is the name of the column in the combobox's datasource which hold string values since you are setting the CellValueType to string.

Also, you should make sure operatorColumn is the 3rd column since you are using the code:
this.productGridGrouper.Binder.InternalColumns[2].StyleInfo.DataSource = this.ds3.Tables["Operator"];



AD Administrator Syncfusion Team December 8, 2006 07:45 PM UTC

Hi Clay,
I tried all those changes without success. I'm bound to the right table/column, since the list is there in the drop-down. I can pull down any of the values, but the moment I click on anothe cell, the value disappears.
Does it matter that the dropdowns are bound to a different data source than other bound columns in the grid?



>You need to set

operatorColumn.ReadOnly = false;

Also, you should set:
operatorColumn.DisplayMember = "SomeColumnName";
operatorColumn.ValueMember = "SomeColumnName";

where SomeColumnName is the name of the column in the combobox's datasource which hold string values since you are setting the CellValueType to string.

Also, you should make sure operatorColumn is the 3rd column since you are using the code:
this.productGridGrouper.Binder.InternalColumns[2].StyleInfo.DataSource = this.ds3.Tables["Operator"];



AD Administrator Syncfusion Team December 9, 2006 12:49 AM UTC

No. The only thing you need to check is the type of the column from the grid's DataSource is the same as the column you are using from combobox's datasource. Here is a minimal sample.

http://www.syncfusion.com/Support/user/uploads/WindowsApplication45_2d4533fd.zip

Does this sample work for you? If not, what version of our library are you using? I tried it with the 4.4.0.51 version.


AD Administrator Syncfusion Team December 13, 2006 05:39 PM UTC

Hi,
I couldn't run your sample as it is in a later version of Studio. I have other samples with databound combos that display default values and persist a default value even while clicking other cells --

I am using SyncFusion 4.3.30 - but as I said, I can't imagine that that is the cause, as other samples seem to be fine. I'm stumped.




AD Administrator Syncfusion Team December 14, 2006 06:57 AM UTC

Hi,

We were not able to reproduce the issue here. Is it possible for you to upload us a sample or modify the attached samples to reproduce the issue here? This will help us to analyse the issue further.

Here is a sample.
GDBGComboBoxCell.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon