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

setting a value to combo box

hi, if i have a combo box with value member and display member as two different coulmns in the database.For example , i have country name as display member and country Id as value member.When the user selects the country from the drop down , i need to save the country id. Is there any property by which i can get the country Id when i select the country name. similarly while fetching back data , i get the country id from the database and how do i set it to the combo box so that the right country name is displayed ??

1 Reply

AD Administrator Syncfusion Team April 20, 2005 05:01 AM

Try code like this: //if you have added GridBoundColumns GridStyleInfo style = grid.GridBoundColumns["MyColumnname"].SyleInfo; //if you have not added GridBoundColumns GridStyleInfo style = grid.Binder.InternalColumns["MyColumnname"].SyleInfo; style.DataSource = dt; //dt is the datatable holdingthe related columns style.ValueMember = "ValueMemberColumnName"; style.DisplayMember = "DisplayMemberColumnName"; style.CellType = "ComboBox"; Take a look at the \Essential Suite\3.0.1.0\Windows\Grid.Windows\Samples\DataBound\GDBGcombos. It does everything in the designer so you would have to open up the designer generated code to see what was done in code.

Loader.
Live Chat Icon For mobile
Up arrow icon