How to modify any form data fields in .Net Web form


Q: How to modify any form data fields (add, update, delete) before showing to the end-user.

A: 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")

Save datas fields in FormData with .NET Code