tags:

views:

371

answers:

2

I have a datagridview with several columns, one of which is a combobox. When I click off the combo box the Display member changes to the Value member. My guess is that this is somehow do to info in the data table that I bind to the datagridview. I'm using subsonic to create the table. Anyone else have something similar happen?

A: 

What is the Datasource? A SubSonic Collection?

Try this one:

dataGridView1.DataSource = new OrderCollection().Load();

var comboBox1 = dataGridView1.Columns["colProduct"];

comboBox1.DisplayMember = Product.Columns.Name; // or just "Name"
comboBox1.ValueMember = Product.Columns.Id;
comboBox1.DataSource = new ProductCollection().OrderBy(Product.Columns.Name).Load();
comboBox1.DataPropertyName = Order.ProductId;

And don't forget to handle the DataError Event, to avoid the nasty StackTrace MessageBox if a ProductId isn't found.

SchlaWiener
A: 

did you ever get an answer to this? I have the same problem and I'm searching for hours for a solution

Wolfgang