Class ActionFailedEventArgs
Provides data for the ActionFailed event, raised when a Spreadsheet action fails to complete.
Inherited Members
Namespace: Syncfusion.Blazor.Spreadsheet
Assembly: Syncfusion.Blazor.Spreadsheet.dll
Syntax
public class ActionFailedEventArgs
Remarks
This class contains information about an error that occurred during a Spreadsheet action.
It exposes the name of the action that failed via Action and the exception that caused the failure via Error.
The event is raised when a Spreadsheet operation fails, allowing you to inspect error details and implement custom error-handling logic.
Use this event to log failures, display error messages to users, perform diagnostics, or execute recovery actions.
Examples
This example demonstrates how to handle the ActionFailed event and retrieve the action and error information when a Spreadsheet action fails.
<SfSpreadsheet ActionFailed="OnActionFailed">
<SpreadsheetRibbon></SpreadsheetRibbon>
</SfSpreadsheet>
@code {
private void OnActionFailed(ActionFailedEventArgs args)
{
if (args.Error != null)
{
// Log the failed action and the error message
Console.WriteLine($"Spreadsheet action '{args.Action}' failed: {args.Error.Message}");
// Display user-friendly error message
// ShowErrorDialog(args.Error.Message);
}
}
}
Constructors
ActionFailedEventArgs()
Declaration
public ActionFailedEventArgs()
Properties
Action
Gets the name of the Spreadsheet action that failed.
Declaration
public string Action { get; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the action name. The default value is null. |
Remarks
This property identifies the operation that failed.
Typical values include actions such as Edit, Cut, Copy, Paste, Delete, Sort, Filter, Open, Save, Undo, and Redo.
You can use this property to conditionally log or route failures to different handlers based on the operation type.
Error
Gets the exception information associated with the failed Spreadsheet action.
Declaration
public Exception Error { get; }
Property Value
| Type | Description |
|---|---|
| Exception | An Exception object that provides details about the error that occurred during action execution. The default value is null. |
Remarks
This property contains the exception that caused the Spreadsheet operation to fail.
The exception provides details such as the error message, exception type, and stack trace for diagnostic purposes.
You can access the Message property to get a human-readable description of the error, or use GetType() to determine the specific exception type.