Class CellEditingEventArgs
Provides data for the CellEditing event.
Inherited Members
Namespace: Syncfusion.Blazor.Spreadsheet
Assembly: Syncfusion.Blazor.Spreadsheet.dll
Syntax
public class CellEditingEventArgs
Remarks
This class contains details about the cell being edited, including its address, current value, and position indices.
The event is triggered when editing begins in a cell, allowing for interception and potential cancellation of the edit operation.
Use this event to implement custom validation or pre-editing logic before changes are made to the cell.
Examples
This example demonstrates how to handle the CellEditing event to prevent editing in specific cells.
<SfSpreadsheet CellEditing="OnCellEditing">
</SfSpreadsheet>
@code {
private void OnCellEditing(CellEditingEventArgs args)
{
// Prevent editing in the first row
if (args.RowIndex == 0)
{
args.Cancel = true;
}
}
}
Constructors
CellEditingEventArgs()
Declaration
public CellEditingEventArgs()
Properties
Address
Gets the address of the cell being edited.
Declaration
public string Address { get; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the cell address in the format "SheetName!A1". The default value is null. |
Remarks
This property provides the full qualified address including the sheet name and cell reference.
It can be used to identify the exact location of the cell being edited within the spreadsheet.
Cancel
Gets or sets a value indicating whether the cell edit operation should be cancelled.
Declaration
public bool Cancel { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether to cancel the edit. The default value is false. |
Remarks
Setting this to true prevents the cell from entering edit mode.
This can be used to implement read-only behavior for specific cells based on custom conditions.
ColumnIndex
Gets the zero-based column index of the cell being edited.
Declaration
public int ColumnIndex { get; }
Property Value
| Type | Description |
|---|---|
| int | An int representing the column index, starting from 0. The default value is |
Remarks
This index can be used for column-specific logic, such as restricting edits in certain columns.
RowIndex
Gets the zero-based row index of the cell being edited.
Declaration
public int RowIndex { get; }
Property Value
| Type | Description |
|---|---|
| int | An int representing the row index, starting from 0. The default value is |
Remarks
This index can be used for row-specific logic, such as restricting edits in header rows.
Value
Gets the current value of the cell before editing.
Declaration
public object Value { get; }
Property Value
| Type | Description |
|---|---|
| object | An object representing the existing cell value, which could be a string, number, or other data type. The default value is null. |
Remarks
This property holds the value present in the cell at the start of the editing process.
It allows for comparison or validation against the existing data before any changes are applied.