Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
    Overview
   [Expand]Getting Started
   [Collapse]Fundamentals
    [Expand]RichEditControl
    [Expand]Document
     Supported Document Formats
    [Collapse]Fields
     [Expand]Field Codes
     [Expand]Format Switches
      Field Structure
      Inserting a Field
      Field Display Modes
      Updating a Field
      Field Types
     Commands
     Services
     Layout API
     Product Class Structure
     Default Keyboard Shortcuts
     Measure Units
     HTML Tag Interpretation
   [Expand]Concepts
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Updating a Field

Expanded Overview

To calculate the field result, a field needs to be updated. Fields are updated automatically when the document is saved, printed, or a mail merge operation is performed.

However, you can also update a field on demand. To update a field, use the Field.Update method. An end-user can update a specific field using the corresponding command in the context menu.

The UpdateFieldsCommand, which is executed by pressing the F9 key, updates the field results for all fields in the current selection. To update all fields in a document, an end-user can select all fields by pressing CTRL+A, and execute the UpdateFieldsCommand by pressing F9. Another technique involves switching on the View Merged Data command button corresponding to the ToggleViewMergedDataCommand. In code, you can update all fields by calling the FieldCollection.Update method.

Expanded Locked Fields

You can prevent a field from being updated by setting its Field.Locked property to true in code. End-users can execute the LockFieldCommand by positioning the caret within the field and pressing CTRL+F11. To unlock a field, set the Field.Locked property to false in code or press CTRL+SHIFT+F11.

You can update locked fields by changing the RichEditControl's FieldOptions.UpdateLockedFields option.

This option is particularly useful for DOCVARIABLE fields, because a locked DOCVARIABLE field is not updated during mail merge or document insertion. The RichEditControl.CalculateDocumentVariable event does not occur for a locked DOCVARIABLE field, and the field value remains unchanged. Subsequently, you can set the FieldOptions.UpdateLockedFields option to the UpdateLockedFields.DocVariableOnly value and update the field.

In the CalculateDocumentVariable event handler, you can use the CalculateDocumentVariableEventArgs.FieldLocked property to determine whether a field for which the event is raised is locked.

How would you rate this topic?​​​​​​​