Spread for ASP.NET 12 Product Documentation
Setting a Check Box Cell
Spread for ASP.NET 12 Product Documentation > Developer's Guide > Customizing with Cell Types > Working with Graphical Cell Types > Setting a Check Box Cell

A check box cell displays, by default, a small check box that can have one of two states, checked or unchecked. You can customize the check box by specifying the images for the two states. You can also specify whether the value is Boolean (true or false) or an integer (0 or 1). Default appearances are shown here.

Appearances of Check Box Cell Types

To create a cell that acts like a check box, follow this procedure.

For details on the properties and methods for this cell type, refer to the CheckBoxCellType class in the Assembly Reference.

Using Code

  1. Define the check box cell type by creating an instance of the CheckBoxCellType class.
  2. Specify the properties of the check box cell.
  3. Enter the text that goes along with each check box.
  4. Specify the location of the images for the checked and unchecked boxes if you do not want to use the defaults.
  5. Assign the check box cell type to a cell (or cells).

Example

This example creates a check box cell with custom images and text.

C#
Copy Code
FarPoint.Web.Spread.CheckBoxCellType chkbx = new FarPoint.Web.Spread.CheckBoxCellType();
chkbx.Text = "Spotted";
chkbx.CheckedImageUrl = "img/checked.gif";
chkbx.UncheckedImageUrl = "img/unchecked.gif";
FpSpread1.ActiveSheetView.Cells[0, 0].CellType = chkbx; 
VB
Copy Code
Dim chkbx As New FarPoint.Web.Spread.CheckBoxCellType()
chkbx.Text = "Spotted"
chkbx.CheckedImageUrl = "img/checked.gif"
chkbx.UncheckedImageUrl = "img/unchecked.gif"
FpSpread1.ActiveSheetView.Cells(0, 0).CellType = chkbx 

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