Spread for ASP.NET 9.0 Product Documentation > Developer's Guide > Customizing with Cell Types > Working with Graphical Cell Types > Setting a Multiple-Column Combo Box Cell |
You can create a combo box cell with multiple columns in the drop-down list. You can provide a drop-down list and allow the user to choose from a displayed list.
You specify the list of items by binding the cell. You can also choose which column is displayed in the edit area of the cell with the ColumnEditName property.
The multi-column combo cell can be bound to data by setting the DataSource, DataSourceID, DataMember, DataColumn, or DataColumnName property.
For details on the properties and methods for the multi-column combo box cell type, refer to the MultiColumnComboBoxCellType class in the Assembly Reference.
For details on the combo cell type, refer to the ComboBoxCellType class in the Assembly Reference.
Display a multi-column combo cell.
C# |
Copy Code
|
---|---|
string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source= C:\\common\\Patients2000.mdb"; string sqlStr = "SELECT * FROM Patients"; System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr); System.Data.DataSet ds = new System.Data.DataSet(); System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn); da.Fill(ds); FarPoint.Web.Spread.MultiColumnComboBoxCellType mcombo = new FarPoint.Web.Spread.MultiColumnComboBoxCellType(); mcombo.DataSource = ds; mcombo.DataColumnName = "Patients"; mcombo.ShowButton = true; fpSpread1.Sheets[0].Cells[0, 0].CellType = mcombo; |
VB |
Copy Code
|
---|---|
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source= C:\Common\Patients2000.mdb" Dim sqlStr As String = "SELECT * FROM Patients" Dim conn As New System.Data.OleDb.OleDbConnection(conStr) Dim ds As System.Data.DataSet = New System.Data.DataSet() Dim da As New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn) da.Fill(ds) Dim mcombo As New FarPoint.Web.Spread.MultiColumnComboBoxCellType() mcombo.DataSource = ds mcombo.DataColumnName = "Patients" mcombo.ShowButton = True FpSpread1.Sheets(0).Cells(0, 0).CellType = mcombo |