Create a table with a column of controls c#

Viewed 24

I am trying to create a datagridview based on a datatable. It is made out of 2 columns. First column i want it to be String type, and the second one i want it to be a bunch of textboxes,checkboxlists,comboboxes etc and i cannot find a way to get it done

                DataTable dtdiagtext = new DataTable();
                dtdiagtext.Columns.Add("Config Options", typeof(string));
                dtdiagtext.Columns.Add(ModelIerarhic.SelectedNode.Parent.Name, typeof(object));
                dtdiagtext.Rows.Add(new object[] { "a", "abc" });
                dtdiagtext.Rows.Add(new object[] { "a", "Abc" });
                dataGridView1.DataSource = dtdiagtext;               
 DataTable dtdiagbool = new DataTable();
                dtdiagbool.Columns.Add("Config Options", typeof(string));
                dtdiagbool.Columns.Add(ModelIerarhic.SelectedNode.Parent.Name, typeof(object));

                dtdiagbool.Rows.Add(new object[] { "a", false });
                dtdiagbool.Rows.Add(new object[] { "a", true });
               // dtdiagtext.Merge(dtdiagbool , true, MissingSchemaAction.Ignore);
                dataGridView2.DataSource = dtdiagbool;

I tried to set the second column as bool and it creates checkboxes, but i cannot insert values there. Is there a way to add controls on the second column? As for reference i want it to look like this:preview of what i want to do

0 Answers
Related