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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Select values in a ComboBox in a GridControl in a WinForm

Thread ID:





36864 Nov 11,2005 09:42 AM UTC Nov 11,2005 02:19 PM UTC WinForms 3
Tags: GridControl
Geir Aamodt
Asked On November 11, 2005 09:42 AM UTC

I have a cell of the ComboBox type which uses a datasource and display/value-members. I would like to pre-select specific values in the combo before displaying it to the user. So if the combox contains the values 1, 5, 10 and 20 I would like 10 to be displayed in the combo when the user opens the form. This would be somewhat similar to use SetSelectedIndex = 2 in a standard Windows combobox. Thanks in advance.

Administrator [Syncfusion]
Replied On November 11, 2005 10:19 AM UTC

Try setting the CellValue to be the value member of the entry you want to see. So if the display member has a value of "Apple", and its corresponding valuememer is 192, then try setting: grid[rowIndex, colIndex].CellValue = 192;

Geir Aamodt
Replied On November 11, 2005 01:39 PM UTC

That works perfectly, thanks a lot Clay. Another ComboBox follow up; is it possible to have text in the combo that is not part of the datasource. Like when you open the form and in the combo you find the text "Please select Color" (or something like that.

Administrator [Syncfusion]
Replied On November 11, 2005 02:19 PM UTC

There are no property setting for this. You would have to code it. One way to try to do this would be to use a GridListControl celltype and show the column headers in the GridListControl. You could make the first header in the GridListControl a covered cell and put your text there. But it would likely require handling events on the embedded grid within the gridlistcontrol to get this working.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon