TX Sheet Control

ValidationFailure Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Api.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll
Implements
IEquatable<ValidationFailure>

Detached cell validation failure; stop-style violations roll back the entire attempted transaction.

Syntax

public class ValidationFailure

Interfaces: IEquatable<ValidationFailure>.

Members

Constructors

ConstructorDescription
Constructor

Properties

PropertyDescription
Address
Message
Rule

Examples

Create a working document workflow using ValidationFailure. Return the generated document or application data to the caller.

using TXTextControl.TXSheetControl.Server;

async Task<string[]> BuildValidationFailureExampleAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    await sheet.Cell("B8").SetValueAsync(-5);
    await sheet.Validation.SetAsync("B8:B9", new ValidationRule { Type = "decimal", Operator = "between", Formula1 = "0", Formula2 = "10000", ErrorMessage = "Enter an amount between 0 and 10000." });

    var failures = await sheet.Validation.CheckAsync("B8");
    return failures.Select(failure => failure.Address + ": " + failure.Message).ToArray();
}

See Also