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

**URL:** <https://discuss.workflowgen.com/t/form-designer-how-to-add-custom-code-on-the-submit-as-draft-event-in-the-asp-net-server-side-code-behind/763>\
**Category:** Form Designer\
**Created:** [May 3, 2017, 1:47pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-add-custom-code-on-the-submit-as-draft-event-in-the-asp-net-server-side-code-behind/763 "2017-05-03T13:47:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [May 3, 2017, 1:47pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-add-custom-code-on-the-submit-as-draft-event-in-the-asp-net-server-side-code-behind/763/1 "2017-05-03T13:47:56Z")

</div>

```auto
//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); 
    }

```
