Skip to main content
A newer version of this page is available.

SnapEntity.BeginUpdate() Method

Enables runtime customization of a SnapEntity.

Namespace: DevExpress.Snap.Core.API

Assembly: DevExpress.Snap.v20.2.Core.dll

NuGet Package: DevExpress.Snap.Core

Declaration

void BeginUpdate()

Remarks

Each Snap field in a document corresponds to a specific SnapEntity that is returned by the ISnapFieldOwner.ParseField method. Any modification of an entity at runtime must be wrapped in the BeginUpdate and SnapEntity.EndUpdate method calls.

After calling the BeginUpdate method, the SnapEntity.Active property becomes enabled until the SnapEntity.EndUpdate method is called. A document can only contain one active entity at one time.

The following requirements apply to the proper customization of a SnapEntity at runtime.

  • To learn whether or not the customization is opened for an entity, consult its SnapEntity.Active property value.

    To learn whether or not the customization is opened for a specific entity, use the ISnapFieldOwner.ActiveEntity property.

  • To open an entity for runtime customization, call its BeginUpdate method.

    To apply the new settings, call the SnapEntity.EndUpdate method.

Do not call the SnapEntity.EndUpdate method for a parent entity until there is no active nested entity left within it.

Nested Fields

If a document contains multiple entities that are nested inside each other (e.g., in case of a master-detail report), only the outermost (parent) field in this document is active.

The parent field’s data is contained in one or more SnapDocument objects assigned to the field templates (e.g., SnapList.RowTemplate, SnapListGroupInfo.Header, or SnapListGroupInfo.Footer).

To modify the content of a nested field within a parent field’s document, do the following.

  1. Obtain the nested field from a corresponding SnapDocument.
  2. Parse the field by calling the ISnapFieldOwner.ParseField method that returns the appropriate SnapEntity.
  3. Call the BeginUpdate method of the returned entity.
  4. After making the required changes, make sure to call the SnapEntity.EndUpdate method for the nested entity.
  5. Call the SnapEntity.EndUpdate method for the parent entity.

The following code snippets (auto-collected from DevExpress Examples) contain references to the BeginUpdate() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also