Spread for ASP.NET 11 Product Documentation
Setting a Multiple-Column Combo Box Cell
Spread for ASP.NET 11 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.

Multi Column Combo Cell

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.

Using Code

  1. Define the multi-column combo cell type by creating an instance of the MultiColumnComboBoxCellType class.
  2. Create a dataset.
  3. Specify the list of options by binding.
  4. Set the display properties such as the ShowButton property.
  5. Assign the cell type to a specific cell.

Example

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

Using the Spread Designer

  1. In the work area, select the cell or cells for which you want to set the cell type.
  2. Select the Home menu.
  3. Select the SetCellType icon under the CellType section.
  4. Select the cell type and any other cell properties.
  5. Select OK to close the dialog.
  6. Click Apply and Exit to close the Spread Designer.
See Also