0

I have a GridControl with a loaded datatable to it (with datasource):

DataTable table = GetData();
GridControl1.DataSource = table; 

How can I add a column of comboboxes?

Jongware
  • 22,200
  • 8
  • 54
  • 100
noni r
  • 23
  • 6

1 Answers1

-1

You can use the below code, after assigning the datasource into the DataGridView, we have to do the following code.

        dataGridView1.DataSource = dt;
        dataGridView1.Refresh();

        DataGridViewComboBoxColumn cmbColumn = new DataGridViewComboBoxColumn();
        cmbColumn.HeaderText = "Select ComboBox";
        cmbColumn.Name = "ComboBox";
        cmbColumn.MaxDropDownItems = 4;
        cmbColumn.Items.Add("Item1");
        cmbColumn.Items.Add("Item2");
        dataGridView1.Columns.Add(cmbColumn);
        dataGridView1.Refresh();
Manu Nair
  • 314
  • 2
  • 7
  • 1
    you wrote me about dataGridView1, but my mission is about GridControl.. how do i add a combobox to gridcontrol? – noni r Dec 01 '14 at 10:57