Skip to main content

Fields.UpdateAsync(Field, CancellationToken) Method

Updates the specified field.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v24.1.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public ValueTask UpdateAsync(
    Field field,
    CancellationToken cancellationToken = default(CancellationToken)
)

Parameters

Name Type Description
field Field

The field to update.

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken null

An object that propagates a cancellation notification.

Returns

Type Description
ValueTask

A structure that stores an awaitable result of an asynchronous operation.

Remarks

Update a field to calculate and display the field result.

The following example creates and updates a DATE field.

<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            Field dateField = await documentAPI.Fields.CreateAsync(0, "DATE");
            await documentAPI.Fields.UpdateAsync(dateField);
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

The UpdateAllAsync(Boolean, CancellationToken) method allows you to update every field in a sub-document or in all sub-documents.

See Also