title: When exactly does the OnItemUpdated event fire specifically in a FormView in ASP.NET?
body: <p>I can't for the life of me figure out when OnItemUpdated gets fired. I've been messing around in ASP.NET trying to learn it, so some of the things you see in this code might be purposely done the hard way (so I can better understand whats going on behind the scenes)</p>
  
  <p>Basically, I have a GridView that is the master control that uses a formview as a detail.</p>
  
  <p>Here is the <code>SelectedIndexChanged</code> method for <code>GridView</code></p>
  
  <pre><code>protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
  {
      var context = new DataAccessLayer.SafetyEntities();
      var se = (from c in context.Employees
                    where c.EID == (long)GridView1.SelectedDataKey.Value
                    select c).ToList();
      FormView1.DataSource = se;
      FormView1.DataKeyNames = new string[] { "EID" };
      FormView1.DataBind();
  }
  </code></pre>
  
  <p>That's working fine, it displays the selected details in the form for editing. This is what the <code>formview</code> looks like:</p>
  
  <pre><code>&lt;asp:FormView ID="FormView1" runat="server" DefaultMode="Edit" OnItemUpdating = "FormView1_ItemUpdating" OnItemUpdated="BLAH"&gt;
      &lt;ItemTemplate&gt;
          Select an employee!
       &lt;/ItemTemplate&gt;
       &lt;EditItemTemplate&gt;
           &lt;table&gt;
               &lt;tr&gt;
                   &lt;th&gt;Name: 
                   &lt;/th&gt;
                      &lt;td&gt;
                          &lt;asp:TextBox runat="server" ID ="NameEdit" Text='&lt;%#Bind("Name") %&gt;' /&gt; 
                      &lt;/td&gt;
                      &lt;br /&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;th&gt;Manager: 
                  &lt;/th&gt;
                  &lt;td&gt;
                      &lt;asp:DropDownList ID = "DDLEdit1" DataSourceID = "ManagerEntitySource" runat="server"
                             DataTextField = "Option_Value" DataValueField = "Option_Value"
                             SelectedValue = '&lt;%#Bind("Manager") %&gt;'  
                             AppendDataBoundItems="true"&gt;
                      &lt;/asp:DropDownList&gt; 
                  &lt;/td&gt;
                  &lt;br /&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;th&gt;Location: 
                  &lt;/th&gt;
                  &lt;td&gt;
                      &lt;asp:DropDownList ID="DDLEdit2" DataSourceID = "LocationEntitySource" runat="server"
                             DataTextField = "Option_Value" DataValueField = "Option_Value"
                             SelectedValue='&lt;%#Bind("Building") %&gt;' 
                             AppendDataBoundItems="true"&gt;
                      &lt;/asp:DropDownList&gt;
                  &lt;/td&gt;
                  &lt;br /&gt;
          &lt;/table&gt;
          &lt;asp:Button ID="Button2" Text="Submit Changes" runat="server" CommandName="Update" /&gt;
              &lt;!--&lt;asp:LinkButton ID = "LB1" Text="Update" CommandName="Update" runat="server" /&gt; --&gt;
      &lt;/EditItemTemplate&gt;       
  &lt;/asp:FormView&gt;
  </code></pre>
  
  <p>This works as well. You can see from the attributes of the <code>FormView</code> that I specify <code>OnItemUpdating</code> and <code>OnItemUpdated</code>.</p>
  
  <p>Here is <code>OnItemUpdating</code>:</p>
  
  <pre><code>protected void FormView1_ItemUpdating(object source, FormViewUpdateEventArgs e)
  {
     DebugBox.Text = FormView1.DataKey.Value.ToString();
     DataAccessLayer.SafetyEntities se = new DataAccessLayer.SafetyEntities();
     var key = Convert.ToInt32(FormView1.DataKey.Value.ToString());
     DataAccessLayer.Employee employeeToUpdate = se.Employees.Where(emp =&gt; emp.EID == key).First();
     employeeToUpdate.Name = e.NewValues["Name"].ToString();
     employeeToUpdate.Manager = e.NewValues["Manager"].ToString();
     employeeToUpdate.Building = e.NewValues["Building"].ToString();
     se.SaveChanges();
     GridView1.DataBind();
  
  }
  </code></pre>
  
  <p>This works fine as well. The items are being updated appropriately and the <code>GridView</code> is refreshing.</p>
  
  <p>Here is <code>OnItemUpdated</code>:</p>
  
  <pre><code>protected void BLAH(object source, FormViewUpdatedEventArgs e)
  {
      DebugBox2.Text = "BLAH!!!!";
  }
  </code></pre>
  
  <p>And here is the problem. This never gets called! Am I missing a step somewhere to get this event to fire? I thought I understood that the button would call Command="Update" which would fire ItemUpdating and then ItemUpdated. Its definitely calling ItemUpdating, but thats it. Do I need something additional to fire ItemUpdated?    </p>