Question
How do I modify any form data fields (add, update, delete) before showing to the end-user?
Answer
Use the FormData
object in order to modify the data directly in the form data. If you want to save the form data after the modification, make sure to call this.SaveFormData(this.FormData)
.
The following example will delete all the rows of a GridView when a specific action is launched:
protected void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
// Clears the REQUEST_GRIDVIEW1 rows in the this.FormData (loaded in memory) then rebind the form fields to it
if (!Page.IsPostBack && this.CurrentWorkflowActionName == "UPDATES")
{
this.FormData.Tables["REQUEST_GRIDVIEW1"].Rows.Clear();
this.FormData.Tables["REQUEST_GRIDVIEW1"].AcceptChanges();
this.SaveFormData(this.FormData);
this.BindFormDataToFields(this.FormData);
}
}