Spread ASP.NET 18
Spread for ASP.NET 18 Product Documentation / Developer's Guide / Customizing with Cell Types / Working with Editable Cell Types / Setting a Percent Cell
In This Topic
    Setting a Percent Cell
    In This Topic

    You can use a percent cell to display percent values. In a percent cell type, a value of 0.35 is displayed as 35%. You can use a percent cell for displaying values as percentages and restricting inputs to percentage numeric values.

    Percent Cell Example

    The percent cell has a default error message that is displayed if the user types an invalid value and tries to leave the cell.

    Percent Cell: Default Error Message

    For details on the properties and methods for this cell type, refer to the PercentCellType class.

    Using Code

    1. Define the percent cell type by creating an instance of the PercentCellType class.
    2. Assign the percent cell type to a cell.

    Example

    This example sets a cell to be a percent cell.

    C#
    Copy Code
    FarPoint.Web.Spread.PercentCellType pctcell = new FarPoint.Web.Spread.PercentCellType();
    FpSpread1.ActiveSheetView.Cells[1, 1].CellType = pctcell;
    
    VB
    Copy Code
    Dim pctcell As New FarPoint.Web.Spread.PercentCellType()
    FpSpread1.ActiveSheetView.Cells(1, 1).CellType = pctcell
    

    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