ASPxSpreadsheet.CellValueChanged Event
Occurs after the cell content has been changed via the ASPxSpreadsheet UI.
Namespace: DevExpress.Web.ASPxSpreadsheet
Assembly: DevExpress.Web.ASPxSpreadsheet.v24.2.dll
NuGet Package: DevExpress.Web.Office
#Declaration
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.
Inherited from Spreadsheet |
Column |
Gets the index of the column that contains the cell.
Inherited from Spreadsheet |
Formula |
Gets the formula that is currently contained in the cell.
Inherited from Spreadsheet |
Formula |
Gets the formula in the invariant culture that is currently contained in the cell.
Inherited from Spreadsheet |
Old |
Gets the cell’s previous formula. |
Old |
Gets the cell’s previous formula in the invariant culture. |
Old |
Gets the cell’s previous value. |
Row |
Gets the index of the row that contains the cell.
Inherited from Spreadsheet |
Sheet |
Gets the name of the worksheet that contains the cell.
Inherited from Spreadsheet |
Value |
Gets the value currently contained in the cell.
Inherited from Spreadsheet |
Worksheet |
Gets the worksheet that contains the cell.
Inherited from Spreadsheet |
#Remarks
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.
protected void Page_Load(object sender, EventArgs e) {
if (!Page.IsPostBack) {
string currentUserID = GenerateUniqueId();
var user = Users.Register(currentUserID);
var templatePath = Server.MapPath("~/App_Data/WorkDirectory/CellValueChangedSample.xlsx");
var documentId = GenerateUniqueId();
user.DocumentIDs.Add(documentId);
spreadsheet.Open(documentId, DocumentFormat.Xlsx, () => System.IO.File.ReadAllBytes(templatePath));
}
}
private static string GenerateUniqueId() {
return Guid.NewGuid().ToString();
}
Note
By default, the Celltrue
.
The Cell