Filling gridview with multiple combobox
-
Hi, I am sorry for some earlier posts as i was bit confused on my design of application... Ok..I have BillDetails,Products,Packing Table... And on winform I have gridview...Now in gridview I want to display billdetails table..but somehow the first two columns need to be combobox..and these combobox should take data from Products Table together with Packing.. I have screen shot as what exist in those tables..Also below is a small code that i have done but i see only one dropdown list with nothing populated... Please HELP..I will really appreciate as i am stuck in it for few days
:confused:void fillData()
{
OleDbConnection database = new OleDbConnection(connectionString);
database.Open();
OleDbDataAdapter adapter1 = new OleDbDataAdapter("SELECT BillDetails.ProductID, BillDetails.ProductName, BillDetails.InQty, BillDetails.InBns, BillDetails.InPrice, BillDetails.Dis1, Products.packing, BillDetails.Saletype, BillDetails.SBtype, Products.FactorC, Products.FactorB, BillDetails.Type FROM Products INNER JOIN BillDetails ON Products.ProdID = BillDetails.ProductID", database);
//OleDbDataAdapter adapter1 = new OleDbDataAdapter("Select Products.ProdID,Products.ProductName,Packing.PackingName,Products.CPrice from Packing INNER JOIN Products ON Packing.PackingID=Products.Packing", database);DataGridViewComboBoxColumn dgridcolumn = new DataGridViewComboBoxColumn(); dgridcolumn.Name = "Products"; this.dataGridView1.Columns.Add(dgridcolumn); DataTable dt = new DataTable(); DataTable packDT = new DataTable(); adapter1.Fill(dt); dataGridView1.DataSource = dt; adapter1.Fill(packDT); dgridcolumn.DataSource = packDT; dgridcolumn.ValueMember = packDT.Columns\[1\].ColumnName.ToString(); dgridcolumn.DisplayMember = packDT.Columns\[1\].ColumnName.ToString(); }