# Form designer: How to trigger a .Net function from a form field event?

**URL:** <https://discuss.workflowgen.com/t/form-designer-how-to-trigger-a-net-function-from-a-form-field-event/252>\
**Category:** Form Designer\
**Created:** [August 23, 2013, 10:27pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-trigger-a-net-function-from-a-form-field-event/252 "2013-08-23T22:27:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [August 23, 2013, 10:27pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-trigger-a-net-function-from-a-form-field-event/252/1 "2013-08-23T22:27:28Z")

</div>

You can add your own .NET functions in the ASP.NET form view in the Form Designer. To trigger your function from a form field event (such as when the field value is changed), you have to use ASP.NET events. The supported events are listed in the form field’s custom attributes.

You can find an example of implementation in the built-in **Expense Report** template.

In the GridView `DESCRIPTION` field, there is a custom attribute (an ASP.NET server-side event) called `onselectedindexchanged`  
whose value is `EXPENSES_GRIDVIEW_DESCRIPTION_Changed`.

In the .NET code-behind view there is the following method:

```auto
void EXPENSES_GRIDVIEW_DESCRIPTION_Changed(Object sender, EventArgs e) {
  DropDownList ddl = sender as DropDownList;
  if (ddl.SelectedValue == "CAR") {
    ((TextBox) this.EXPENSES_GRIDVIEW.Rows[this.EXPENSES_GRIDVIEW.EditIndex].Cells[2].Controls[0]).Text = "150";
  } else if (ddl.SelectedValue == "HOTEL") {
    ((TextBox) this.EXPENSES_GRIDVIEW.Rows[this.EXPENSES_GRIDVIEW.EditIndex].Cells[2].Controls[0]).Text = "199.50";
  } else if (ddl.SelectedValue == "FLIGHT") {
    ((TextBox) this.EXPENSES_GRIDVIEW.Rows[this.EXPENSES_GRIDVIEW.EditIndex].Cells[2].Controls[0]).Text = "832.50";
  } else {
    ((TextBox) this.EXPENSES_GRIDVIEW.Rows[this.EXPENSES_GRIDVIEW.EditIndex].Cells[2].Controls[0]).Text = "";
  }
}

```

Actually, you have find the right custom attribute (in the ASP.NET events section) and call the .NET server-side method.

For a checkbox, you can use `oncheckedchanged` custom attribute.
