Aspose.Cells.GridWeb.Examples.CSharp.Cells.ProtectCells.chkAllCells_CheckedChanged C# (CSharp) Method

chkAllCells_CheckedChanged() protected method

protected chkAllCells_CheckedChanged ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        protected void chkAllCells_CheckedChanged(object sender, EventArgs e)
        {
            chkSelectedCells.Checked = false;

            if (chkAllCells.Checked)
            {
                // ExStart:MakeAllCellsEditable
                // Accessing the reference of the worksheet that is currently active
                GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];

                // Setting all cells of the worksheet to Editable
                sheet.SetAllCellsEditable();
                // ExEnd:MakeAllCellsEditable

                Label1.Text = "All cells are editable now.";
            }
            else
            {
                // ExStart:MakeAllCellsReadOnly
                // Accessing the reference of the worksheet that is currently active
                GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];

                // Setting all cells of the worksheet to Readonly
                sheet.SetAllCellsReadonly();
                // ExEnd:MakeAllCellsReadOnly

                Label1.Text = "All cells are readonly now.";
            }
        }