Form designer: How to add custom code on the "Submit As Draft" event in the ASP.NET server side code-behind?

//PageLoad
protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        //Remove button where it is not used.
        if (this.CurrentWorkflowActionName != "INITIATES")
        {
            saveAsDraftButton.Visible=false;
            
        }
        // Add custom event for save as draft button
        else
        {
            saveAsDraftButton.Click += new EventHandler(MySaveAsDraftButton_Click);
        }
        
    }

   protected void MySaveAsDraftButton_Click(object sender, EventArgs e)
    {
       // Your code... 
       // If you modify the form field's value then you have to call the instruction below at the end.
       // this.SaveFormData(this.FormData, true); 
    }
1 Like