How to save form field captions to form data

As of WorkflowGen 6.0.3 and WorkflowGen.My 3.0.2 (also applicable to WorkflowGen 5.7.4 and WorkflowGen.My 2.4.0), the values of form field captions are no longer saved to the form data XML file by default.

This helps to create a lighter form data XML file, resulting in overall better file size optimization and response time.

This change will affect all asp:Label controls that have a cssClass of FieldCaptionLabel, HeaderTitleLabel, FooterTitleLabel, and SectionHeaderTitle.

If you want to revert to the previous behavior, see the instructions in the To bind captions with form data (the former default behaviour) section below.

API public properties with default values

bool BindCaptionsToFormData = false; // Bind form captions to the Form Data
List<string> CaptionsCssClasses =new List<string>() { "FieldCaptionLabel","HeaderTitleLabel","FooterTitleLabel","SectionHeaderTitle" };
Methods
To add a "caption" type class that will not be bound:

protected override void OnPreLoad(EventArgs e)
{
 if(!IsPostBack)
 {
  // Add a label input to the list of captions that will not be bound to the form data.
  // Only the asp:Label web control is supported (labels used in the form designer always translate to asp:Label).
  this.CaptionsCssClasses.Add("FieldValueInput"); 
 }

 base.OnPreLoad(e);
}
//To bind captions with form data (the former default behaviour):

protected override void OnPreLoad(EventArgs e)
{
 this.BindCaptionsToFormData = true;    
 base.OnPreLoad(e);
}