Click here to Skip to main content
13,090,678 members (44,631 online)
Rate this:
Please Sign up or sign in to vote.
See more:

Please let me know where I am going wrong in loading data in the DatagridviewComboboxColumn.

Below is the code.

//Loading the DataGridview and adding the ComboBoxColumn using below method.

private void LoadDataGridview()

                using (QuotationBusiness objQuotationBusiness = new QuotationBusiness())
                    dtDeliveryNoteDetails = objQuotationBusiness.GetDeliveryNoteDetails(PickingNoteNo);
                if (dtDeliveryNoteDetails != null)
                    gvDeliveryNoteDetails.DataSource = dtDeliveryNoteDetails;
  DataGridViewComboBoxColumn cmbpackingtype = new DataGridViewComboBoxColumn();
                    cmbpackingtype.Name = "cmbPackingTypes";
                    cmbpackingtype.HeaderText = "Packing Type";
                    cmbpackingtype.ReadOnly = false;                    
///Loading Data into ComboBox                   
            catch (Exception ex)
 private void LoadPackagingTypeDetails(DataGridViewComboBoxColumn cmbpackingtype)
            using (QuotationBusiness objQB = new QuotationBusiness())
                DataTable dtPackingTypes = objQB.GetPackagingTypeDetails();
                if (dtPackingTypes != null)
                    DataRow row = dtPackingTypes.NewRow();
                    row["PackageType"] = "Select";
                    row["PackageTypeID"] = 0;
                    dtPackingTypes.Rows.InsertAt(row, 0);  
                    cmbpackingtype.DataSource = dtPackingTypes;  //using a datatable as Datasource to Combobox                 
                    cmbpackingtype.ValueMember = "PackageTypeID";
                    cmbpackingtype.DisplayMember = "PackageType";
                    cmbpackingtype.DefaultCellStyle.NullValue = "--Select--";



But the ComboBox is not loading with the Data.When I click on the Combobox even the dropdown is not displayed.Just the --Select-- is displayed.How do we change the style to DropDownList and load the data.
Posted 25-Mar-13 2:15am

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 25 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100