ASPxSpreadsheet.CellValueChanged Event

Occurs after the cell content has been changed via the ASPxSpreadsheet UI.

Namespace: DevExpress.Web.ASPxSpreadsheet

Assembly: DevExpress.Web.ASPxSpreadsheet.v21.2.dll


public static event CellValueChangedEventHandler CellValueChanged

Event Data

The CellValueChanged event's data class is SpreadsheetCellEventArgs. The following properties provide information specific to this event:

Property Description
Action Identifies an action which caused a change of the cell value.
Cell Gets the cell for which the event is fired.
ColumnIndex Gets the index of the column that contains the cell.
Formula Gets the formula that is currently contained in the cell.
FormulaInvariant Gets the formula in the invariant culture that is currently contained in the cell.
OldFormula Gets the cell’s previous formula.
OldFormulaInvariant Gets the cell’s previous formula in the invariant culture.
OldValue Gets the cell’s previous value.
RowIndex Gets the index of the row that contains the cell.
SheetName Gets the name of the worksheet that contains the cell.
Value Gets the value currently contained in the cell.
Worksheet Gets the worksheet that contains the cell.


The CellValueChanged event fires after the cell content has been changed as a result of end-user interaction. The list below provides the possible reasons for this event being raised:

  • The cell content has been modified via the cell in-place editor or formula bar. The cell editor is closed and the entered value is committed to an active cell or selected cells when an end-user clicks outside the edited cell, or presses ENTER, CTRL+ENTER or CTRL+SHIFT+ENTER.
  • The cell content has been removed when an end-user pressed DELETE.
  • A new hyperlink has been added to a cell via the Insert Hyperlink dialog, or an existing hyperlink has been modified via the Change Hyperlink dialog.

The CellValueChanged event must have a static event handler and it raises for all documents opened within all instances of the ASPxSpreadsheet control. To identify a document for which the event was raised, use the event sender (of the SpreadsheetDocumentInfo type) containing the DocumentId property (OfficeDocumentBase<T>.DocumentId).

The code below demonstrates how a handler can be assigned to the CellValueChanged event in the Global.asax file’s Application_Start method.

<%@ Application Language="C#" %>
<%@ Import Namespace="DevExpress.Web.ASPxSpreadsheet" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="DevExpress.Spreadsheet" %>
<%@ Import Namespace="Sample" %>

<script RunAt="server">
    void Application_Start(object sender, EventArgs e) {
        ASPxSpreadsheet.CellValueChanged += Spreadsheet_CellValueChanged;

    static void Spreadsheet_CellValueChanged(object sender, DevExpress.XtraSpreadsheet.SpreadsheetCellEventArgs e) {
        Logger.SaveChangesToLog(sender, e.Cell.GetReferenceA1(), e.OldValue, e.Value);

        if (e.Cell.ColumnIndex == 0 && e.Cell.RowIndex > 0) 
            e.Worksheet.Cells[e.Cell.RowIndex, 1].Value = SampleData.Lookup(e.Value.ToString());


By default, the CellValueChanged event does not occur when changing cell content via code. However, this event will also be triggered by changes made via an API if you set the ASPxSpreadsheet.RaiseEventsOnModificationsViaAPI property to true.

The CellValueChanged event does not occur when a cell value is changed after a formula has been recalculated, even if the recalculation has been caused by the ASPxSpreadsheet UI.

See Also