Edit this page


This column has RadMultiColumnComboBoxElement as an editor. It covers the features that the RadMultiColumnComboBox control has.

gridview-columns-gridviewmulticomboboxcolumn 001

The following example demonstrates how to manually generate columns for RadGridView in the dropdown and then make the dropdown autosize itself according to the width of the RadGridView columns.

First of all, we should bind the GridViewMultiComboBoxColumn:

GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn();
col.DataSource = orderDetailsBindingSource;
col.DisplayMember = "Quantity";
col.ValueMember = "OrderID";
col.FieldName = "OrderID";
col.HeaderText = "Custom";
this.radGridView1.CellBeginEdit += new GridViewCellCancelEventHandler(radGridView1_CellBeginEdit);

Dim col As GridViewMultiComboBoxColumn = New GridViewMultiComboBoxColumn()
col.DataSource = orderDetailsBindingSource
col.DisplayMember = "Quantity"
col.ValueMember = "OrderID"
col.FieldName = "OrderID"
col.HeaderText = "Custom"
AddHandler RadGridView1.CellBeginEdit, AddressOf radGridView1_CellBeginEdit

Then, we make the necessary implementation in the CellBeginEdit event handler:

Setup the editor

bool isColumnAdded;
void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    if (this.radGridView1.CurrentColumn is GridViewMultiComboBoxColumn)
        if (!isColumnAdded)
            isColumnAdded = true;
            RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.radGridView1.ActiveEditor;
            editor.EditorControl.MasterTemplate.AutoGenerateColumns = false;
            editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("OrderID"));
            editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("Quantity"));
            editor.AutoSizeDropDownToBestFit = true;

Private isColumnAdded As Boolean
Private Sub radGridView1_CellBeginEdit(ByVal sender As Object, ByVal e As GridViewCellCancelEventArgs)
    If TypeOf Me.radGridView1.CurrentColumn Is GridViewMultiComboBoxColumn Then
        If (Not isColumnAdded) Then
            isColumnAdded = True
            Dim editor As RadMultiColumnComboBoxElement = CType(Me.radGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
            editor.EditorControl.MasterTemplate.AutoGenerateColumns = False
            editor.EditorControl.Columns.Add(New GridViewTextBoxColumn("OrderID"))
            editor.EditorControl.Columns.Add(New GridViewTextBoxColumn("Quantity"))
            editor.AutoSizeDropDownToBestFit = True
        End If
    End If
End Sub

Please note that we have a 'dirty' flag, because the editors in RadGridView are reused. If we do not have such a flag, new OrderID and Quantity columns will be added each time a RadMultiColumnComboBoxElement editor is opened.

Other important properties for GridViewMultiComboBoxColumn are:

  • FilterMode: has two values DisplayMember and ValueMember, and as the name of the property speaks this setting will determine whether the column will be filtered according to the DisplayMember or the ValueMember.

  • DisplayMemberSort: this property will determine whether the column will be sorted by the column's DisplayMember or ValueMember. Setting it to true will sort by DisplayMember, otherwise the sorting will be executed according to the ValueMember.

See Also