Hi,
I have a datagridview in my windows application to which i have to add combo box to a column. Combo box in each row will have different datasource based on the values in the other columns of the same row. I tried with the following code.
DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn();
col.HeaderText = "Test";
col.DataSource = ds.Tables[0];
col.DisplayMember = ds.Tables[0].Columns[0].ToString();
col.ValueMember = ds.Tables[0].Columns[0].ToString();
col.DefaultCellStyle.NullValue = ds.Tables[0].Rows[0][0].ToString();
col.FlatStyle = FlatStyle.Flat;
dataGridView1.AllowUserToAddRows = false;
col.DisplayIndex = ds.Tables[0].Columns.Count + 1;
dataGridView1.DataSource = ds.Tables[0].DefaultView;
dataGridView1.Columns.Add(col);
But i need to bind a different datasource for each combobox column. Kindly let me know. Its very urgent. Any help would be appreciated.
Thank You,
Hari


Reply With Quote


Bookmarks