Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Filling gridview with multiple combobox

Filling gridview with multiple combobox

Scheduled Pinned Locked Moved C#
helpdatabasedesign
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haroon1980
    wrote on last edited by
    #1

    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();
            
           
        }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups