How do you databind a ComboBoxCellType to a datasource

Posted by: john-shugart on 8 September 2017, 2:18 pm EST

  • Posted 8 September 2017, 2:18 pm EST

    <P>How can I bind my comboBoxCelltype to a regular comboBox with a datasource. I know this has to be simple, but I can't seem to get it.</P>
    <P>Thanks in advance,</P>
    <P>John</P>
  • Replied 8 September 2017, 2:18 pm EST

    <P>Hello John,</P>
    <P>There is no direct way to bind the items in our combobox celltype to a DataSource. You would need to programatically loop your DataSet, get the items and creating a string array to set as the Items property of the combobox celltype.</P>
    <P>Or you can try creating a single column MultiColumnComboBoxCellType and sets the DataSource using DataSourceList property for the list portion of the combo box. </P>
    <P>Please have a look at the attached sample and let us know your further observations on the same. </P>
    <P>Hope this will help you. Thanks.<BR></P>
    2010/04/SetComboxCellTypeDatasource.zip
  • Replied 8 September 2017, 2:18 pm EST

    <p>You can create a new CellType that inherits from comboBoxCelltype and expose the properties that you need to bind to the data source. Here is an example of the how I do it. If you need it, I can send the custom cell type code as well.<br></p><p> </p><p>FieldComboBoxCellType FieldComboBox = new FieldComboBoxCellType();<br>this.fpSpreadMatching_Sheet1.Columns[0].DataField = "Field";<br>this.fpSpreadMatching_Sheet1.Columns[0].Label = "Field";<br>this.fpSpreadMatching_Sheet1.Columns[0].CellType = FieldComboBox;<br>this.fpSpreadMatching_Sheet1.Columns[0].Locked = false;<br>FieldComboBox.ListItems = (List<Field>)Presenter.Context.DataProject.Domains.Current.GetScalarFieldDefinitions(); <br>FieldComboBox.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter;<br>FieldComboBox.Editable = false;<br>FieldComboBox.MaxDrop = 8;<br>this.fpSpreadMatching_Sheet1.Columns[0].Width = 150;<br> </p><p>Hope that it helps. </p>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels