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 ??
ADAdministrator 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\188.8.131.52\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.