The DevExpress ASP.NET Spreadsheet enables you to execute custom server code in response to a sheet cell value change. For this purpose, the Spreadsheet provides the CellValueChanged event.
The CellValueChanged event fires on the server side after a cell's content has been changed as a result of end-user interaction. This event is raised for all documents opened within all Spreadsheet instances in a web application. So, to handle the CellValueChanged event, you need to use a static event handler function, which can be accessed globally. It is recommended to subscribe to the Spreadsheet's CellValueChanged event in the Global.asax file's Application_Start method as the following demo code illustrates.
void Application_Start(object sender, EventArgs e) {
...
ASPxSpreadsheet.CellValueChanged += SpreadsheetGlobalHandlers.OnCellValueChanged;
...
}
To identify a document for which the CellValueChanged event is raised, use the event's sender parameter. The type of this parameter (SpreadsheetDocumentInfo) provides the DocumentId property that uniquely identifies the processed document.
In this demo, the CellValueChanged event is handled to respond to entering a shipment tracking number into the C3 data cell and to obtain shipment details from a server data source (which might contain large data in a real application).
Local Copy of this Demo To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer. |
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxSpreadsheetDemos |