WorkflowPage Class Reference

Accessible methods Overridable methods Properties ViewState and Session

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.

C#

protected void Page_Load(object sender, System.EventArgs e)
{
// ...
// Fill your form data here
FillFormData (formData);
// ...
}

Note: 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 try to find controls in the 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 selections 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

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Save the file attachments to EFORMASPXstorage path
this.SaveFileAttachment(TEST_UPLOAD.PostedFile);
// Automatically update the form data with the web form values
this.SaveFieldsData(formData);
// ...
}

void BindFormDataToFields(DataSet)

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.

C#

protected void Page_Load(object sender, EventArgs e)
{
// ...
// bind the page
if (!Page.IsPostBack)
{
BindFormDataToFields(formData);
}
}

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.

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Usually, you will want to save your form data before submitting
this.saveFormData(formData);
// ...
}

void SaveFormData (DataSet, Boolean saveFieldsData)

Use this method to save the web form values into a form data 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.

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Usually, you will want to update and save your form data before submitting
this.SaveFormData(formData, true);
// ...
}

void SubmitToWorkflow()

Use this method when you want to submit the web form to WorkflowGen and redirect from the web form to WorkflowGen.

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Submits everything to the workflow and created the form archive
// automatically if needed.
this.SubmitToWorkflow();
}

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. This will skip all of the required fields including the GridView. (This is available since WorkflowGen.My version 2.2.5.)

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Submits everything to the workflow and creates the form archive
// automatically if needed.
this.SubmitToWorkflow(true);
}

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.

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Submits everything to the workflow and creates the form archive
// automatically if needed.
this.SubmitToWorkflow(formData);
}

void SubmitToWorkflow(DataSet, Boolean saveFieldsData)

Use this method when you want to submit the web form to WorkflowGen, save your fields data to your form data, save your form data, and then redirect from the web form to WorkflowGen.

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ..,
// Submits everything to the workflow and creates the form archive
automatically if needed.
this.SubmitToWorkflow(formData, true);
}

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.

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Save the file attachment to EFORMASPX
SaveFileAttachment(TEST_UPLOAD.PostedFile);
// ...
}

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.

C#

protected void Submit_Click(object sender, System.EventArgs e)
{
// ...
// Save the file attachment to EFORMASPX
SaveFileAttachment(TEST_UPLOAD.PostedFile,
"FileNameYouChoose.ext");
// ...
}

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.

C#

protected override string GetFormArchive()
{
StringBuilder htmlContent = new StringBuilder();
// Build any HTML code you want inside the htmlContent object
// ...
// ...
// return the result at the end
return htmlContent.ToString();
}

void ChangeFormArchiveLayout()

Override this method in order to customize the form archive layout.

C#

protected override void ChangeFormArchiveLayout()
{
// Perform custom treatments here
// ...
// Make sure you call the base ChangeFormArchiveLayout if you want the
// fields to automatically be put to read-only and hide fields that are
// listed in FORM_ARCHIVE_HIDDEN_FIELDS
base.ChangeFormArchiveLayout();
}

void ChangeFormLayout()

Override this method in order to customize your web form layout.

C#

protected override void ChangeFormLayout()
{
// Make sure you call the base ChangeFormLayout before doing
anything else
// because if you call it at the end, you will override your custom
changes.
base.ChangeFormArchiveLayout();
// Perform custom treatments here
// e.g.:
if (CurrentWorkflowActionName == "...")
{
// ...
}
else if (...)
{
// ...
}
}

Properties

string CurrentWorkflowActionName (read-only)

  • The name of the current WorkflowGen action.

  • It will be empty if you did not give a CURRENT_ACTION parameter in your activity.

C#

if (CurrentWorkflowActionName == "...")
{
// ...
}

string LangId (read-only)

  • The current culture code of the connected WorkflowGen user.

  • Culture code example: en-US

C#

if (LangId == "en-US")
{
// Do some culture-specific treatment...
}

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

C#

FileStream myfs = new FileStream(this.StoragePath + "\\signedXml.xml",
FileMode.Create, FileAccess.ReadWrite);

string RequiredFieldsErrorMessage (read and write)

  • The error message for required fields.

  • Default value: The {0} field is required.

  • This value needs to contain {0} and will contain the field name.

C#

this.RequiredFieldsErrorMessage = Resources.Strings.RequiredErrorMessage;

string FormArchiveFileName (read and write)

  • The form archive file name

  • Default value: form_archive.htm

C#

this.FormArchiveFileName = "archive.html";

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

C#

this.ReadOnlyFieldsBorderColor = Color.Green;

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.

C#

this.RequiredFieldsBorderColor = Color.Orange;

ColorizationType FieldsColorization (read and write)

  • The colorization type for the required, read-only, and updatable fields

  • Possible values: Automatic, Css, None

  • Default value: Automatic

C#

this.FieldsColorization = Fields.ColorizationType.Css;

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.

C#

if (!this.IsStandAloneMode)
Page.DataBind();

Boolean IsSimpleMode (read and write)

  • This property determines if you are running the WorkflowPage in Advanced or Simple mode.

  • This property needs to be determined in the web form's constructor.

  • Default value: true

C#

this.IsSimpleMode = false;

Boolean HandleSubmitButton (read and write)

  • This property determines if the 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

C#

this.HandleSubmitButton = false;

DataSet FormData (read-only)

  • This property contains the form data DataSet managed by the WorkflowPage if you are in Simple mode.

  • This property is only available in Simple mode.

C#

FormData.Tables["Table1"].Rows[0]["REQUEST_DATE"] = DateTime.Now.ToString();

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.

C#

this.RequiredGridViewsErrorMessage =
Resources.Strings.RequiredGridViewsErrorMessage;

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 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.

C#

this.InvalidNumberGridViewErrorMessage =
Resources.Strings.InvalidNumberGVErrMsg;

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.

C#

this.InvalidCurrencyGridViewsErrorMessage =
Resources.Strings.InvalidCurrGVErrMsg;

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.

C#

this.RequiredColumnsInGridViewsErrorMessage =
Resources.Strings.RequiredColInGV;

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.

C#

this.InvalidDateGridViewErrorMessage = Resources.Strings.InvalidDateGVErrMsg;

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.

C#

this.ColorizeRequiredColumnsInGridViewHeader = true;

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.

C#

this.InvalidNumberErrorMessage = Resources.Strings.InvalidNumberErrMsg;

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.

C#

this.InvalidCurrencyErrorMessage = Resources.Strings.InvalidCurrencyErrMsg;

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.

C#

this.InvalidDateErrorMessage = Resources.Strings.InvalidDateErrMsg;

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 the WorkflowPage instead of using the Session.

  • Default value: false

  • This property must be determined in the constructor of the web form.

C#

this.IsSessionLess = true;

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.

C#

this.SaveFormDataWithSchema = false;

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

C#

this.RemoveValidatorsInFormArchive = true;

boolean ValidateRequiredFields (read and write)

  • If this property is set to false, all 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.

C#

this.ValidateRequiredFields = false;

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.

Important: 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

Contents
Accessible methods
void FillFormData(DataSet or XmlDocument)
void SaveFieldsData(DataSet)
void BindFormDataToFields(DataSet)
void SaveFormData(DataSet or XmlDocument)
void SaveFormData (DataSet, Boolean saveFieldsData)
void SubmitToWorkflow()
void SubmitToWorkflow(isDraftMode)
void SubmitToWorkflow(DataSet or XmlDocument)
void SubmitToWorkflow(DataSet, Boolean saveFieldsData)
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