title: Clicking Update in the EditCommandColumn of an ASP.NET DataGrid does not initiate the Click event defined in codebehind
body: <p>I have a DataGrid that receives data from several tables in an Entity Data Model.I used an EditCommandColumn to provide editing of the data as well as TemplateColumns that are bound to the columns of a Function Import from a Stored Procedure on the database. </p>
  
  <p>Here is the portion of the .aspx code for the creation of the asp:DataGrid</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="gridUpdate" runat="server" UpdateMode="Conditional"&gt;
      &lt;ContentTemplate&gt;
          &lt;div style="vertical-align: top; height:250px; overflow:auto; width:1800px;"&gt;
              &lt;asp:DataGrid ID="dgdEditQ" runat="server" AllowPaging="True" AllowSorting="True" 
                      BackColor="AntiqueWhite" BorderColor="Green" BorderStyle="Ridge" 
                      CellPadding="10" Font-Bold="True"
                      Font-Size="Large" Width="1800px" Height="250px" OnEditCommand="dgdEditQ_Edit"
                      OnCancelCommand="dgdEditQ_Cancel" OnUpdateCommand="dgdEditQ_Update"
                      CellSpacing="10" ViewStateMode="Disabled" ItemStyle-Wrap="False" 
                      ItemStyle-Width="100" AutoGenerateColumns="False"&gt;
  
                  &lt;AlternatingItemStyle /&gt;
                  &lt;Columns&gt;
                      &lt;asp:EditCommandColumn
                              EditText="Edit"
                              CancelText="Cancel"
                              UpdateText="Update"
                              HeaderText="Edit item"
                              ButtonType="LinkButton"&gt;
                      &lt;/asp:EditCommandColumn&gt;
  
                      &lt;asp:TemplateColumn Visible="true"&gt;
                          &lt;HeaderTemplate&gt;
                              &lt;b&gt; Quote Number &lt;/b&gt;
                          &lt;/HeaderTemplate&gt;   
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label  runat="server" Text='&lt;%#Eval("QuoteNumber") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;                                                          
                      &lt;/asp:TemplateColumn&gt;
  
                      &lt;asp:TemplateColumn Visible="false"&gt;
                          &lt;HeaderTemplate&gt;
                              &lt;b&gt; Name &lt;/b&gt;
                          &lt;/HeaderTemplate&gt;   
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblEdN"  runat="server" Text='&lt;%#Eval("Name") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox runat="server" Text='&lt;%#Eval("Name") %&gt;' ID="txbEdName" MaxLength="50"&gt;&lt;/asp:TextBox&gt;
                              &lt;asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="txbEdName" ErrorMessage="The name of the quote is required."&gt;&lt;/asp:RequiredFieldValidator&gt;
                          &lt;/EditItemTemplate&gt;                                                          
                      &lt;/asp:TemplateColumn&gt;
  
                      &lt;asp:TemplateColumn Visible="false"&gt;
                      &lt;HeaderTemplate&gt;
                          &lt;b&gt; Street &lt;/b&gt;
                      &lt;/HeaderTemplate&gt;   
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblEdSt"  runat="server" Text='&lt;%#Eval("Street") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                      &lt;EditItemTemplate&gt;
                          &lt;asp:TextBox runat="server" Text='&lt;%#Eval("Street") %&gt;' ID="txbEdStreet" MaxLength="50"&gt;&lt;/asp:TextBox&gt;
                      &lt;/EditItemTemplate&gt;                                                          
                      &lt;/asp:TemplateColumn&gt;
  
                      &lt;asp:TemplateColumn Visible="false"&gt;
                      &lt;HeaderTemplate&gt;
                          &lt;b&gt; City &amp; State &lt;/b&gt;
                      &lt;/HeaderTemplate&gt;   
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblEdCS"  runat="server" Text='&lt;%#Eval("CityState") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                      &lt;EditItemTemplate&gt;
                          &lt;asp:TextBox runat="server" Text='&lt;%#Eval("CityState") %&gt;' ID="txbEdCS" MaxLength="50"&gt;&lt;/asp:TextBox&gt;
                      &lt;/EditItemTemplate&gt;                                                         
                      &lt;/asp:TemplateColumn&gt;
  
                  &lt;/Columns&gt;
                  &lt;SelectedItemStyle /&gt;
              &lt;/asp:DataGrid&gt;
          &lt;/div&gt;
      &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;     
  </code></pre>
  
  <p>When I click Edit in the EditCommandColumn that works everytime and the Cancel does as well, but the Update button click never triggers the onclick eventhandler in my code behind:</p>
  
  <pre><code>protected void dgdEditQ_Update(Object sender, DataGridCommandEventArgs e)
      {
          DataGridItem dgi = dgdEditQ.SelectedItem;
          TextBox[] myBoxes = new TextBox[26];
          string[] myParams = new string[26];
  
          myBoxes[0] = (TextBox)dgi.FindControl("Quote Number");
          myBoxes[1] = (TextBox)dgi.FindControl("Name");
          myBoxes[2] = (TextBox)dgi.FindControl("Street");
          myBoxes[3] = (TextBox)dgi.FindControl("City &amp; State");
          myBoxes[4] = (TextBox)dgi.FindControl("Type of Quote");
          myBoxes[5] = (TextBox)dgi.FindControl("List Provided By");
          myBoxes[6] = (TextBox)dgi.FindControl("Estimator");
          myBoxes[7] = (TextBox)dgi.FindControl("Date Received");
          myBoxes[8] = (TextBox)dgi.FindControl("Date Due");
          myBoxes[9] = (TextBox)dgi.FindControl("Date of Plans");
          myBoxes[10] = (TextBox)dgi.FindControl("Date of Revision");
          myBoxes[11] = (TextBox)dgi.FindControl("Revision #");
          myBoxes[12] = (TextBox)dgi.FindControl("Plan Name");
          myBoxes[13] = (TextBox)dgi.FindControl("Customer");
          myBoxes[14] = (TextBox)dgi.FindControl("Amount");
          myBoxes[15] = (TextBox)dgi.FindControl("Quote Status");
          myBoxes[16] = (TextBox)dgi.FindControl("Excel File");
          myBoxes[17] = (TextBox)dgi.FindControl("Folder Location");
          myBoxes[18] = (TextBox)dgi.FindControl("Architect");
          myBoxes[19] = (TextBox)dgi.FindControl("Architectural Firm");
          myBoxes[20] = (TextBox)dgi.FindControl("Architect's Phone");
          myBoxes[21] = (TextBox)dgi.FindControl("Architect's Fax");
          myBoxes[22] = (TextBox)dgi.FindControl("Engineer");
          myBoxes[23] = (TextBox)dgi.FindControl("Engineering Firm");
          myBoxes[24] = (TextBox)dgi.FindControl("Engineer's Phone");
          myBoxes[25] = (TextBox)dgi.FindControl("Engineer's Fax");
  
          for (int j = 0; j &lt; 26; j++)
          {
              myParams[j] = myBoxes[j].Text;
          }
      }
  </code></pre>
  
  <p>I am fairly, new to ASP.NET but all the research I have done thus far has not provided me with answer to why my Update event is not firing when I click the Update button.</p>