Click here to Skip to main content
15,175,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a winform in which I have a DataGridView.
mapped the datasource of the DataGridView from a database table. than at run time i created a DataGridViewComboBoxColumn and populate its value and added that DataGridViewComboBoxColumno column to the existing DataGridView

Now since DataGridViewComboBoxColumno is a combobox column, user can select any value from the drop down which is the part of DataGridView.

I need solution from which I am able to get the complete datatable along with the DataGridViewComboBoxColumn, user select on runtime so that i can update the same on database.



DataSet ds = new DataSet();

adapter.Fill(ds);

DataTable recordsTable = new DataTable();
recordsTable = ds.Tables[0];

dataGridView1.DataSource = recordsTable;
connection.Close();

DataGridViewComboBoxColumn dgvCmb = new DataGridViewComboBoxColumn();
{
dgvCmb.HeaderText = "SET Priority";
dgvCmb.Items.Add("HIGH");
dgvCmb.Items.Add("MEDIUM");
dgvCmb.Items.Add("LOW");
dgvCmb.Name = "cmbName";
dgvCmb.DisplayMember = "Name";
dgvCmb.ValueMember = "self";
dgvCmb.AutoComplete = true;
dgvCmb.MaxDropDownItems = 3;
dgvCmb.FlatStyle = FlatStyle.Flat;
}

dataGridView1.Columns.Add(dgvCmb);



how i can get a datatable along with the value user select on DataGridViewComboBoxColumn.
Posted
Updated 10-Sep-13 22:20pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900