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.
Unfortunately, activation email could not send to your email. Please try again.

setting a value to combo box

Thread ID:

Created:

Updated:

Platform:

Replies:

27914 Apr 20,2005 05:45 AM Apr 20,2005 06:01 AM Windows Forms 1
loading
Tags: GridControl
Majesh Peedikakandy
Asked On April 20, 2005 05:45 AM

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 06: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.

CONFIRMATION

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.

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.

;