Spread ASP.NET 16
Spread for ASP.NET 16 Product Documentation / Developer's Guide / Customizing User Interaction / Customizing Selections of Cells / Working with Selections of Cells
In This Topic
    Working with Selections of Cells
    In This Topic

    Besides selections that can be allowed by the end user, you can work with selections to the sheet using code. With code, you can add a selection or remove one or all of the existing selections. Use the AddSelection and ClearSelection methods to add and remove selections using code in the selection model.

    For more information on working with the models, refer to Understanding the Selection Model.

    For information on changing the appearance of selected cells, refer to Customizing the Appearance of Selections.

    Using Code

    You can get a selection on the server side with the following code.

    Example

    The following code gets the first selection.

    C#
    Copy Code
    FarPoint.Web.Spread.Model.CellRange cr = FarPoint.Web.Spread.Model.CellRange;
    cr = FpSpread1.Sheets[0].SelectionModel(0); 
    
    VB
    Copy Code
    Dim cr as FarPoint.Web.Spread.Model.CellRange
    cr = FpSpread1.Sheets(0).SelectionModel(0)