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

setting a value to combo box

Thread ID:





27914 Apr 20,2005 09:45 AM UTC Apr 20,2005 10:01 AM UTC WinForms 1
Tags: GridControl
Majesh Peedikakandy
Asked On April 20, 2005 09:45 AM UTC

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 ??

Administrator [Syncfusion]
Replied On April 20, 2005 10:01 AM UTC

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\\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.


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