Home Forums WinForms controls Xceed Grid for WinForms DisplayFormat when binding ComboBoxEditor to DataView

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16552 |

    Hello!

    I’m trying to bind a comboBoxEditor used in my grid to a DataView so I can use the RowFilter capabilities of the DataView.  I specify a display format when I create the editor using the “%name of display field here%” syntax shown in the documentation.  However, when the grid enters edit mode on the cell that uses this editor, it shows me ALL the columns of the DataView, i.e. the default display format. 

    Is it not actually possible to use a DataView as the DataSource for a ComboBoxEditor (the documentation says it is possible)?  I noticed that if I try to set the DataMember property of the ComboBoxEditor to the table that underlies the DataView that I get a “Child list for field (table name) cannot be created” error.

    Has anyone tried this? I’m interested in using a DataView so that I can show just the options relevant to the currently selected row in my Editor (by RowFiltering) while maintaining EVERY option in the DataTable which I bind to the Viewer for this column.

    Thanks!

     

    Imported from legacy forums. Posted by Rich (had 1099 views)

    User (Old forums)
    Member
    Post count: 23064

    It should work fine with a DataView.  Here is a code snippet showing how to have the same column displayed in the DropDown as with the DisplayFormat in the TextBoxArea using a DataView :

    //create DataView

    DataView view = new DataView( this.northwindDataSet.Suppliers );

    view.RowFilter =

    “Country = ‘USA'”;

    //Textbox = DisplayFormat, shows all columns, with DataView

    WinComboBox comboCol = new WinComboBox( EnhancedBorderStyle.None );

    comboCol.SetDataBinding( view,

    “” );

    comboCol.ValueMember =

    “SupplierID”;

    comboCol.DisplayFormat =

    “%CompanyName%”;

    foreach( ColumnInfo col in comboCol.Columns )

    {

        if( col.Name != “CompanyName” )

        col.Visible =

    false;

    }

    gridControl1.Columns[ 0 ].CellEditorManager = new ComboBoxEditor( comboCol );

     

    Imported from legacy forums. Posted by André (had 986 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.