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 celltype

PROBLEM #1 I am using a grid control with a celltype of combobox with the property of ExclusiveChoiceList = False. The problem occurs when the user types a new value into the cell when the cell loses focus the text becomes drop shadowed. PROBLEM #@ I would also like to know how to retreive the comboboxes displayed text instead of the cellvalue used in databinding (.Text and .CellValue return the same value). Any help would be great. Jeff Walstrom

5 Replies

AD Administrator Syncfusion Team December 12, 2002 06:17 PM UTC

> PROBLEM #1 > I am using a grid control with a celltype of combobox with the property of ExclusiveChoiceList = False. The problem occurs when the user types a new value into the cell when the cell loses focus the text becomes drop shadowed. What is drop shadowed? Do you mean it is drawn like disabled text? I guess you have a related data source with DisplayMember and ValueMember set. Now, when you type in a new value then there is no corresponding value to be looked up in the related table. One idea would be to check if the value is in the related table and if not, manually add it. A good place to do this would be a CurrentCellAcceptedChanges event handler. > > PROBLEM #@ > I would also like to know how to retreive the comboboxes displayed text instead of the cellvalue used in databinding (.Text and .CellValue return the same value). > Use .FormattedText instead. Stefan


JW Jeff Walstrom December 12, 2002 07:11 PM UTC

> > PROBLEM #1 > > I am using a grid control with a celltype of combobox with the property of ExclusiveChoiceList = False. The problem occurs when the user types a new value into the cell when the cell loses focus the text becomes drop shadowed. > > What is drop shadowed? Do you mean it is drawn like disabled text? > > I guess you have a related data source with DisplayMember and ValueMember set. Now, when you type in a new value then there is no corresponding value to be looked up in the related table. > > One idea would be to check if the value is in the related table and if not, manually add it. A good place to do this would be a CurrentCellAcceptedChanges event handler. > > > > > > PROBLEM #@ > > I would also like to know how to retreive the comboboxes displayed text instead of the cellvalue used in databinding (.Text and .CellValue return the same value). > > > > Use .FormattedText instead. > > Stefan > > Is there another way to have the text not disabled/dropshadowed wihout adding it to the underlying comboboxes datasource?


AD Administrator Syncfusion Team December 12, 2002 08:52 PM UTC

> Is there another way to have the text not disabled/dropshadowed wihout adding it to the underlying comboboxes datasource? > I can't actually think of any reason why it should be drawn disabled. The default behavior of a combobox is that is resolves the value to a displaymember if it finds the value in the underlying data source. Otherwise it just goes ahead and displays the value. That means you can enter any value and it should be displayed with the same font. I checked our samples but could not see such behavior that you get. You might check if any of your event handlers throws an exception. See the "Debug|Exceptions" menu in Visual Studio Environment. If you continue to have problems, I recommend you open a support incident with direct-trac and attach a small sample that demonstrates the problem. Best would be to take one of our samples and modify it. Stefan


JW Jeff Walstrom December 13, 2002 01:56 PM UTC

> > Is there another way to have the text not disabled/dropshadowed wihout adding it to the underlying comboboxes datasource? > > > > I can't actually think of any reason why it should be drawn disabled. > > The default behavior of a combobox is that is resolves the value to a displaymember if it finds the value in the underlying data source. Otherwise it just goes ahead and displays the value. That means you can enter any value and it should be displayed with the same font. > > I checked our samples but could not see such behavior that you get. > > You might check if any of your event handlers throws an exception. See the "Debug|Exceptions" menu in Visual Studio Environment. > > If you continue to have problems, I recommend you open a support incident with direct-trac and attach a small sample that demonstrates the problem. Best would be to take one of our samples and modify it. > > Stefan The drop shadow only occurs when alpha characters are entered in the cell but does not occur when numeric values are entered. the combobox contains both numeric and alpha characters. Could this be a problem becuase when you hand enter the values it puts the alpha character as the cellvalue(key) when the underlying datasources cellvalue(key) is always a numeric value. Jeff


AD Administrator Syncfusion Team December 13, 2002 03:26 PM UTC

> > The drop shadow only occurs when alpha characters are entered in the cell but does not occur when numeric values are entered. the combobox contains both numeric and alpha characters. Could this be a problem becuase when you hand enter the values it puts the alpha character as the cellvalue(key) when the underlying datasources cellvalue(key) is always a numeric value. > > Jeff > That explains it. The problem is the grid can't save the string value in a numeric column because the underlying datasource will throw an exception when you try to store a string instead. What I would suggest then is to handle the CurrentCellValidated event. This event is called just before the grid saves the string into the underlying datasource. At that point you either add a value in the datatable that is displayed or generate a unique id and store the string in a hashtable. I can't tell right now how difficult this is without trying myself, but if you are ok with such a solution I can try to come up with more concrete steps how to add a string value when it is not found in the combobox. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon