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

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:

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.