I have a grid with a combo box on it that has ExclusiveChoice set to false. I'm binding this to a data table with the DataSource and I have a DisplayMember column that is a string and a ValueMember column that is an int. Now when I'm using this combo box, if I select a value out of the list, I'm fine. However when I type in a value not in the list and then leave the cell, the cell appears as if the text is doubled up and offset. If the ValueMember column is a string I do not get this behavior. Is there a way that I can leave the ValueMember column as an int and not get this weird looking text happening when I type in a value that is not in the list?
ADAdministrator Syncfusion Team May 2, 2003 02:28 PM UTC
What is the CellValueType of that column? Can you make it be typeof(string)?
One reason you might get this shadowed text is because the grid tries to convert the text to an int and that fails.
BMBrenda MaloffMay 2, 2003 03:23 PM UTC
I know the reason I'm getting shadowed text is because of the conversion...if I enter "123" I'm fine, but if I enter "abc" I get the shadowed text. I tried making the CellValueType of type string but to no avail, I get the same thing happening.
ADAdministrator Syncfusion Team May 2, 2003 07:19 PM UTC
One way you can do this is to dynamically add new entries to the datasource of the combobox. You can do this in CurrentCellValidating. In your handler, you can check if the new value is not a number. If it is not, check the datasource to see if the new item is in the displaymember. If it is not, add it to the datatable. Attached is a little sample.
With the upcoming 1.6 release, there are formatting events that you could handle and probably avoid this problem without having to dynamically build your comboboxes data source.