$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Data Grid WinForms Control
Create data gird view in C# with modern user interface for your Windows Forms applications
Home > WinForms UI Controls > User Manual > Multiple ComboBox Columns in C#

C# Grid Multiple ComboBox Column

The Kettic Data Grid Control uses the Data Grid Column objects to represent columns. The Kettic Data Grid Column is the base class of all types of grid columns, including the Grid Multiple ComboBox Column. The Grid Multiple ComboBox Column descends all features of the Kettic Data Grid Column parent class. So this Grid Multiple ComboBox Column shares all features of the Data Grid Column class.

Properties of Grid ComboBox Column

FilterMode, this property contains the DisplayMember and ValueMember values and determines if the column will be filtered or not.
ShowMemberSort, this property is used to sort the column

Generate Grid Multiple ComboBox in C#

The Kettic Grid Multiple ComboBox Column uses the multiple column combobox element as the editor which inherits all features of the ComboBox Column control. In the sample below, we are going to generate the Multiple ComboBox columns for data grid in the dropdown and automatically size the dropdown according to the width of the columns. The following are the C# code to achieve this.

Data Binding of Grid Multiple ComboBox Column


GridMultiComboBoxColumn col = new GridMultiComboBoxColumn();
col.DataSource = orderDetailsBindingSource;
col.ShowMember = "Products";
col.ValueMember = "ProductID";
col.FieldName = "ProductID";
col.HeaderText = "Items";
this.ketticGrid.Columns.Add(col);
this.ketticGrid.CellBeginEdit += new GridCellCancelEventHandler(ketticGrid_CellStartEdit);

Implement CellStartEdit Event Handler


bool isColumnAdded;
void ketticGrid_CellStartEdit(object sender, GridCellCancelEventArgs e)
{
if (this.ketticGridView1.CurrentColumn is GridMultiComboBoxColumn)
{
if (!isColumnAdded)
{
isColumnAdded = true;
KetticMultiColumnComboBoxElement editor = (KetticMultiColumnComboBoxElement)this.ketticGrid.ActiveEditor;
editor.EditorControl.MasterTemplate.AutoGenerateColumns = false;
editor.EditorControl.Columns.Add(new GridTextBoxColumn("ProductID"));
editor.EditorControl.Columns.Add(new GridTextBoxColumn("Product"));
editor.AutoSizeDropDownToBestFit = true;
}
}
}
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls