WorkflowPage Class Reference

Accessible methods

void FillFormData(DataSet or XmlDocument)

Use this method to load the temporary form data XML file (dataOUT.xml) from the current action working directory into the form data IN parameter. You can use a DataSet or an XmlDocument object to receive the form data.
Refer to the StoragePath WorkflowPage class property for the location of the current action working directory.
1
protected void Page_Load(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Fill your form data
6
FillFormData(formData);
7
8
// ...
9
}
Copied!
If there is already some data in your DataSet or XmlDocument, the data will be emptied before being filled.

void SaveFieldsData(DataSet)

This method will attempt to find controls in the web form page that have the same ID as the columns of your form data's Table1; when it finds one, it will update the form data value with the control value.
If the DataType property of the column being filled is Date or Double, the data type of the web form value will be validated and formatted using the current culture code before being pushed into the DataSet. If the value is not consistent with the data type, a FormatException is thrown with an appropriate message telling you which field is not a valid date or double value.
For a FileUpload or an HtmlInputFile control, only the file name is being pushed into the dataset, so you still need to call the SaveFileAttachment method in order to save the file into the EFORMASPX storage path.
To use this method, you must use a DataSet as your form data source.
If a ListBox with multiple selection mode or a CheckBoxList is found for a form data, the value will be all of the selected (or checked) values separated by commas.
The following web controls are supported:
    TextBox
    Label
    DropDownList
    ListBox
    CheckBox
    CheckBoxList
    RadioButton
    RadioButtonList
    FileUpload
    HtmlInputFile
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Save the file attachments to EFORMASPX storage path
6
this.SaveFileAttachment(TEST_UPLOAD.PostedFile);
7
8
// Automatically update the form data with the web form fields value
9
this.SaveFieldsData(formData);
10
11
// ...
12
}
Copied!

void BindFormDataToFields(DataSet, bool isPageDataBind = true)

Use this method when you want to bind all of your web form fields automatically using your form data DataSet. The supported controls are exactly the same as those supported by the SaveFieldsData method.
Set the isPageDataBind parameter to false if you want to skip the call of Page.DataBind() at the beginning of this method. Otherwise, by default, a Page.DataBind() is called at the beginning to ensure that other controls are bound before binding your own web form controls. In some cases, a call to the page databind event might not be desired (e.g. skipping the page databind that was already performed before), or if you want to control exactly when to execute the page databind event instead.
1
protected void Page_Load(object sender, EventArgs e)
2
{
3
// ...
4
5
// Bind the web form controls with the form data on first page load
6
if (!Page.IsPostBack)
7
{
8
BindFormDataToFields(formData);
9
}
10
11
// ...
12
}
Copied!

void SaveFormData(DataSet or XmlDocument)

Use this method to write a form data into the temporary form data XML file (dataOUT.xml) in the current action working directory. You can use a DataSet or an XmlDocument object to update the form data XML file.
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Usually, you will want to save your form data before submitting
6
this.saveFormData(formData);
7
8
// ...
9
}
Copied!

void SaveFormData (DataSet, bool saveFieldValues)

Use this method to save the web form field values into a form data (saveFieldValues set to true) then write the form data into the temporary form data XML file (dataOUT.xml) in the current action working directory.
This method overload is only available if your form data is a DataSet object.
You must set the saveFieldValues parameter to true if you want to save the current state of the web form field values into theform data . This will ensure that the form data values are in sync with the values from the web form fields prior to any manipulations of the web form or form data. For example, it is required to save the web form field values when injecting custom data into the form data prior to reloading the web form using the BindFormDataToFields method. Otherwise, the current state of web form field values could be lost after the refresh. In most scenarios, we suggest setting the saveFieldValues parameter to true before any manipulations that could change the web form or form data.
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Usually, you will want to update and save your form data before submitting
6
this.SaveFormData(formData, true);
7
8
// ...
9
}
Copied!

void SubmitToWorkflow()

Use this method when you want to submit the web form to WorkflowGen and redirect from the web form to WorkflowGen.
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Submits everything to the workflow and creates the form archive
6
// automatically if needed.
7
this.SubmitToWorkflow();
8
9
// ...
10
}
Copied!

void SubmitToWorkflow(isDraftMode)

Use this method when you want to submit the web form to WorkflowGen and redirect from the web form to WorkflowGen in DRAFT mode (isDraftMode set to true). This will skip all of the required fields including GridViews. (This method is available since WorkflowGen.My version 2.2.5.)
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Submits everything to the workflow and creates the form archive
6
// automatically if needed.
7
this.SubmitToWorkflow(true);
8
9
// ...
10
}
Copied!

void SubmitToWorkflow(DataSet or XmlDocument)

Use this method when you want to submit the web form to WorkflowGen, save your form data, and redirect from the web form to WorkflowGen.
This method overload is only available if your form data is a DataSet object.
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Submits everything to the workflow and creates the form archive
6
// automatically if needed.
7
this.SubmitToWorkflow(formData);
8
9
// ...
10
}
Copied!

void SubmitToWorkflow(DataSet, Boolean saveFieldValues)

Use this method when you want to submit the web form to WorkflowGen, save your fields' values to your form data (saveFieldValues set to true), save your form data, and then redirect from the web form to WorkflowGen.
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
4
// ...
5
6
// Submits everything to the workflow and creates the form archive
7
// automatically if needed.
8
this.SubmitToWorkflow(formData, true);
9
10
// ...
11
}
Copied!

string SaveFileAttachment(HttpPostedFile)

Use this method when you want to save a file attachment to the storage path of EFORMASPX in a sub-directory called upload. This method returns the name of the file.
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Save the file attachment to EFORMASPX
6
SaveFileAttachment(TEST_UPLOAD.PostedFile);
7
8
// ...
9
}
Copied!

string SaveFileAttachment (HttpPostedFile, string)

Use this method when you want to save a file attachment to the storage path of EFORMASPX in a sub-directory called upload and you want to specify a file name to use. This method returns the name of the file.
1
protected void Submit_Click(object sender, System.EventArgs e)
2
{
3
// ...
4
5
// Save the file attachment to EFORMASPX
6
SaveFileAttachment(TEST_UPLOAD.PostedFile, "fileName.ext");
7
8
// ...
9
}
Copied!

Overridable methods

string GetFormArchive()

Override this method if you want to customize the output of the form archive. This method has to return a complete HTML page.
1
protected override string GetFormArchive()
2
{
3
StringBuilder htmlContent = new StringBuilder();
4
5
// Build any HTML code you want inside the htmlContent object
6
// ...
7
8
return htmlContent.ToString();
9
}
Copied!

void ChangeFormArchiveLayout()

Override this method in order to customize the form archive layout.
1
protected override void ChangeFormArchiveLayout()
2
{
3
// Perform custom treatments here
4
// ...
5
6
// Make sure you call the base ChangeFormArchiveLayout if you want the
7
// fields to automatically be put to read-only and hide fields that are
8
// listed in FORM_ARCHIVE_HIDDEN_FIELDS
9
10
base.ChangeFormArchiveLayout();
11
}
Copied!

void ChangeFormLayout()

Override this method in order to customize your web form layout.
1
protected override void ChangeFormLayout()
2
{
3
// Make sure you call the base ChangeFormLayout before doing anything else
4
// because if you call it at the end, you will override your custom changes.
5
base.ChangeFormArchiveLayout();
6
7
// Perform custom treatments here
8
// e.g.:
9
if (CurrentWorkflowActionName == "ACTION_NAME1")
10
{
11
// ...
12
}
13
else if (CurrentWorkflowActionName == "ACTION_NAME2")
14
{
15
// ...
16
}
17
}
Copied!

Properties

string CurrentWorkflowActionName (read-only)

    The name of the current WorkflowGen action.
    It will be empty if you did not add a CURRENT_ACTION parameter to your action.
1
if (CurrentWorkflowActionName == "ACTION_NAME")
2
{
3
// ...
4
}
Copied!

string LangId (read-only)

    The current culture code of the connected WorkflowGen user.
    Culture code example: en-US
1
if (LangId == "en-US")
2
{
3
// Do some culture-specific treatment...
4
}
Copied!

string StoragePath (read-only)

    The absolute path to the temporary storage folder of the current action working directory. It is used to read and write the form data and to save the file attachments.
    Value example: DRIVE:\inetpub\wwwroot\wfgen\App_Data\Files\EFORMASPX
1
FileStream myfs = new FileStream(this.StoragePath + "\\signedXml.xml",
2
FileMode.Create, FileAccess.ReadWrite);
Copied!

string RequiredFieldsErrorMessage (read and write)

    The error message for required fields.
    Default value: The {0} field is required.
    This value must contain {0} and will contain the field name.
1
this.RequiredFieldsErrorMessage = Resources.Strings.RequiredErrorMessage;
Copied!

string FormArchiveFileName (read and write)

    The form archive file name.
    Default value: form_archive.htm
1
this.FormArchiveFileName = "my_form_archive.htm";
Copied!

string FormArchiveCssPath (read and write)

    The relative path to the form archive stylesheet.
    Default value: \css\form_archive.css

Color ReadOnlyFieldsBorderColor (read and write)

    The read-only field's border color or text color if it is a drop-down list, checkbox list, or radio button list.
    If the color is Color.Empty, the color will not be affected.
    Default value: Color.Empty
1
this.ReadOnlyFieldsBorderColor = Color.Green;
Copied!

Color RequiredFieldsBorderColor (read and write)

    The required field's border color or text color if it is a drop-down list, checkbox list, or radio button list.
    If the color is Color.Empty, the color will not be affected.
    Default value: Color.Red
1
this.RequiredFieldsBorderColor = Color.Orange;
Copied!

ColorizationType FieldsColorization (read and write)

    The colorization type for required, read-only, and updatable fields.
    Possible values: Automatic, Css, None
    Default value: Automatic
1
this.FieldsColorization = Fields.ColorizationType.Css;
Copied!

Boolean IsStandAloneMode (read-only)

    This property indicates whether or not the web form is running in stand-alone mode.
    Running in stand-alone mode means that the web form was not instantiated by WorkflowGen, but rather by calling the web form address directly without any WorkflowGen parameters.
1
if (!this.IsStandAloneMode)
2
{
3
Page.DataBind();
4
}
Copied!

Boolean IsSimpleMode (read and write)

    This property determines if you are running WorkflowPage in Advanced or Simple mode.
    This property needs to be determined in the web form's constructor.
    Default value: true
1
this.IsSimpleMode = false;
Copied!

Boolean HandleSubmitButton (read and write)

    This property determines if WorkflowPage automatically handles the submit button with the ID SubmitButton. If the property is set to true, you don't have to manage the SubmitButton code.
    This property needs to be determined in the web form's constructor.
    This property is only available in Simple mode.
    Default value: true
1
this.HandleSubmitButton = false;
Copied!

DataSet FormData (read-only)

    This property contains the form data DataSet managed by WorkflowPage if you are in Simple mode.
    This property is only available in Simple mode.
1
FormData.Tables["Table1"].Rows[0]["REQUEST_DATE"] = DateTime.Now.ToString();
Copied!

string RequiredGridViewsErrorMessage (read and write)

    The error message shown to the end-user when a required GridView has not yet been filled in.
    Default value: The {0} list needs to have at least one filled row.
    This value must contain {0}; this symbol will contain the field name.
1
this.RequiredGridViewsErrorMessage =
2
Resources.Strings.RequiredGridViewsErrorMessage;
Copied!

string InvalidNumberGridViewErrorMessage (read and write)

    The error message shown to the end-user when a numeric field has not been filled with a valid numeric value in a GridView.
    Default value: You have entered an invalid number in the {0} column.
    This value must contain {0}; this symbol will contain the field name.
1
this.InvalidNumberGridViewErrorMessage =
2
Resources.Strings.InvalidNumberGVErrMsg;
Copied!

string InvalidCurrencyGridViewsErrorMessage (read and write)

    The error message shown to the end-user when a numeric field has not been filled with a valid currency value in a GridView
    Default value: You have entered an invalid number in the {0} column. Do not enter the currency symbol in the value.
    This value must contain {0}; this symbol will contain the column header text.
1
this.InvalidCurrencyGridViewsErrorMessage =
2
Resources.Strings.InvalidCurrGVErrMsg;
Copied!

string RequiredColumnsInGridViewsErrorMessage (read and write)

    The error message shown to the end-user when a required column has not been filled in a GridView and the end-user tries to update the line
    Default value: The {0} column is required.
    This value must contain {0}; this symbol will contain the column header text.
1
this.RequiredColumnsInGridViewsErrorMessage =
2
Resources.Strings.RequiredColInGV;
Copied!

string InvalidDateGridViewErrorMessage (read and write)

    The error message shown to the end-user when a date or a date/time field in a GridView has not been filled with a valid date or date/time value
    Default value: You have entered an invalid date in the {0} column.
    This value must contain {0}; this symbol will contain the field name.
1
this.InvalidDateGridViewErrorMessage = Resources.Strings.InvalidDateGVErrMsg;
Copied!

boolean ColorizeRequiredColumnsInGridViewHeader (read and write)

    If this property is set to true, the required column headers in the GridViews will have their ForeColor property affected by the RequiredFieldsBorderColor color.
    Default value: false
    This property must be determined in the web form's constructor.
    This property is only available in Simple mode.
1
this.ColorizeRequiredColumnsInGridViewHeader = true;
Copied!

string InvalidNumberErrorMessage (read and write)

    The error message shown to the end-user when a numeric field has not been filled with a valid numeric value.
    Default value: You have entered an invalid number in the {0} field.
    This value must contain {0}; this symbol will contain the field name.
1
this.InvalidNumberErrorMessage = Resources.Strings.InvalidNumberErrMsg;
Copied!

string InvalidCurrencyErrorMessage (read and write)

    The error message shown to the end-user when a numeric field has not been filled with a valid currency value.
    Default value: You have entered an invalid number in the {0} field. Do not enter the currency symbol in the value.
    This value must contain {0}; this symbol will contain the field name.
1
this.InvalidCurrencyErrorMessage = Resources.Strings.InvalidCurrencyErrMsg;
Copied!

string InvalidDateErrorMessage (read and write)

    The error message shown to the end-user when a date or a date/time field has not been filled with a valid date or date/time value.
    Default value: You have entered an invalid date in the {0} field.
    This value must contain {0}; this symbol will contain the field name.
1
this.InvalidDateErrorMessage = Resources.Strings.InvalidDateErrMsg;
Copied!

string ParamsXPath (read-only)

    The value of the ParamsXPath parameter you passed in the WorkflowGen action.
    Default value: NewDataSet/Table1

boolean IsSessionLess (read and write)

    If this property is set to true, the ViewState will be used to store all the internal settings for WorkflowPage instead of using the Session.
    Default value: false
    This property must be determined in the constructor of the web form.
1
this.IsSessionLess = true;
Copied!

boolean SaveFormDataWithSchema (read and write)

    If this property is set to false, the FormData will be saved without its schema.
    Default value: true
    This property must be determined in the constructor of the web form.
1
this.SaveFormDataWithSchema = false;
Copied!

boolean RemoveValidatorsInFormArchive (read and write)

    If this property is set to true, all the validators will be automatically hidden in the form archive.
    Default value: true
1
this.RemoveValidatorsInFormArchive = true;
Copied!

boolean ValidateRequiredFields (read and write)

    If this property is set to false, all of the required fields' validations will be deactivated except the required fields in the GridView controls.
    Default value: true
    This property must be modified before the page's OnLoadComplete event.
1
this.ValidateRequiredFields = false;
Copied!

ViewState and Session

WorkflowPage uses the ViewState or the Session, depending on the IsSessionLess property, to store the EFORMASPX parameters it receives and to store some other internal settings it needs to keep, so the ViewState or the Session of the web form should never be deactivated in order to use WorkflowPage.
Be sure to never use the following ViewState or Session variable names:
    WFGEN_INSTANCE_PATH
    WFGEN_STORAGE_PATH
    WFGEN_REPLY_TO
    WFGEN_CURRENT_ACTION
    WFGEN_IS_STAND_ALONE
    WFGEN_GRID_VIEW_INSERTING
    WFGEN_GRID_VIEW_SHOW_CANCEL
    WFGEN_PARAMS_XPATH
    WFGEN_BACKUP_CONTROL_FORECOLOR
    WFGEN_BACKUP_CONTROL_BORDERCOLOR
    WFGEN_BACKUP_CONTROL_BACKCOLOR
    WFGEN_BACKUP_CONTROL_BORDERWIDTH
    WFGEN_BACKUP_CONTROL_CSSSTYLE
    WFGEN_BACKUP_CONTROL_CSSCLASS
    WFGEN_ALL_SIMPLE_MODE_TABLES
    WFGEN_ALL_SUPPORTED_CONTROLS
    WFGEN_USER_TZ
    WFGEN_SIMPLE_MODE_DATASET_STRUCTURE
    WFGEN_VALIDATE_REQUIRED_FIELDS
    USER_LANG
Last modified 6mo ago
Copy link
Contents
Accessible methods
void FillFormData(DataSet or XmlDocument)
void SaveFieldsData(DataSet)
void BindFormDataToFields(DataSet, bool isPageDataBind = true)
void SaveFormData(DataSet or XmlDocument)
void SaveFormData (DataSet, bool saveFieldValues)
void SubmitToWorkflow()
void SubmitToWorkflow(isDraftMode)
void SubmitToWorkflow(DataSet or XmlDocument)
void SubmitToWorkflow(DataSet, Boolean saveFieldValues)
string SaveFileAttachment(HttpPostedFile)
string SaveFileAttachment (HttpPostedFile, string)
Overridable methods
string GetFormArchive()
void ChangeFormArchiveLayout()
void ChangeFormLayout()
Properties
string CurrentWorkflowActionName (read-only)
string LangId (read-only)
string StoragePath (read-only)
string RequiredFieldsErrorMessage (read and write)
string FormArchiveFileName (read and write)
string FormArchiveCssPath (read and write)
Color ReadOnlyFieldsBorderColor (read and write)
Color RequiredFieldsBorderColor (read and write)
ColorizationType FieldsColorization (read and write)
Boolean IsStandAloneMode (read-only)
Boolean IsSimpleMode (read and write)
Boolean HandleSubmitButton (read and write)
DataSet FormData (read-only)
string RequiredGridViewsErrorMessage (read and write)
string InvalidNumberGridViewErrorMessage (read and write)
string InvalidCurrencyGridViewsErrorMessage (read and write)
string RequiredColumnsInGridViewsErrorMessage (read and write)
string InvalidDateGridViewErrorMessage (read and write)
boolean ColorizeRequiredColumnsInGridViewHeader (read and write)
string InvalidNumberErrorMessage (read and write)
string InvalidCurrencyErrorMessage (read and write)
string InvalidDateErrorMessage (read and write)
string ParamsXPath (read-only)
boolean IsSessionLess (read and write)
boolean SaveFormDataWithSchema (read and write)
boolean RemoveValidatorsInFormArchive (read and write)
boolean ValidateRequiredFields (read and write)
ViewState and Session