title: Gridview validation error is triggered when it should not be
body: <p>I have a gridview that does validation when inserting and editing a row.
  The inserting works fine.  However, when editing a row, the RegularExpressionValidator is triggered for the 'Name' field when I click 'Update'.  The validation is that it must be less than 255 characters.  The field is less than that, yet the error message is always displayed.  I use this validation for editing in another grid and it works fine.  I can't figure out why the error is triggered.</p>
  
  <p>Here is the markup for the grid:</p>
  
  <pre><code>&lt;asp:GridView ID="SectionGridView" runat="server" AllowSorting="True" AutoGenerateColumns="False" Caption="Section Information" CaptionAlign="Top" 
      CssClass="grid" HorizontalAlign="Left" ShowFooter="True" AllowPaging="True" PageSize="4" ShowHeaderWhenEmpty="true" 
      OnPageIndexChanging="SectionGridView_PageIndexChanging" OnRowDataBound="SectionGridView_RowDataBound" OnRowCommand="SectionGridView_RowCommand" 
      OnRowCancelingEdit="SectionGridView_RowCancelingEdit" OnRowEditing="SectionGridView_RowEditing" OnRowUpdating="SectionGridView_RowUpdating"&gt;
      &lt;Columns&gt;
           &lt;asp:TemplateField HeaderText="SectionID" SortExpression="cgvSectionID"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblSectionID" runat="server" Text='&lt;%# Bind("SectionID") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="CourseID"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:DropDownList ID="sgvDdlCourseID" runat="server" &gt;&lt;/asp:DropDownList&gt;
                  &lt;asp:Label ID="sgvEditLblCourseID" runat="server" Visible="false" Text='&lt;%# Bind("CourseID") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblCourseID" runat="server" Text='&lt;%# Bind("CourseID") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
               &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertCourseID" runat="server" ReadOnly="true" Width="90%"&gt;&lt;/asp:TextBox&gt;
              &lt;/FooterTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Name" SortExpression="sgvName"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditName" runat="server" Text='&lt;%# Bind("Name") %&gt;'&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValEditName" ControlToValidate="sgvEditName" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="EditSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValEditName" ControlToValidate="sgvEditName" runat="server" 
                       ErrorMessage="Maximum length is 255." ValidationGroup="EditSectionValidation" ValidationExpression="^{1,255}$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblName" runat="server" Text='&lt;%# Bind("Name") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertName" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertName" ControlToValidate="sgvInsertName" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertName" ControlToValidate="sgvInsertName" runat="server" 
                       ErrorMessage="Maximum length is 255." ValidationGroup="InsertSectionValidation" ValidationExpression="^{1,255}$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="SKU" SortExpression="sgvSKU"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditSKU" runat="server" Text='&lt;%# Bind("SKU") %&gt;'&gt;&lt;/asp:TextBox&gt;
                   &lt;asp:RequiredFieldValidator ID="ReqFieldValEditSKU" ControlToValidate="sgvEditSKU" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="EditSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValEditSKU" ControlToValidate="sgvEditSKU" runat="server" 
                       ErrorMessage="Enter alphanumeric, hyphen, or forward slash. Maximum length is 100." ValidationGroup="EditSectionValidation" ValidationExpression="^[\w-/]{1,100}$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblSKU" runat="server" Text='&lt;%# Bind("SKU") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertSKU" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                   &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertSKU" ControlToValidate="sgvInsertSKU" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertSKU" ControlToValidate="sgvInsertSKU" runat="server" 
                       ErrorMessage="Enter alphanumeric, hyphen, or forward slash. Maximum length is 100." ValidationGroup="InsertSectionValidation" ValidationExpression="^[\w-/]{1,100}$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
  
          &lt;asp:TemplateField HeaderText="Registration Open Date" SortExpression="sgvRegOpenDate"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditRegOpenDate" runat="server" CssClass="datepick" Text='&lt;%# Bind("RegistrationOpen", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblRegOpenDate" runat="server" Text='&lt;%# Bind("RegistrationOpen", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertRegOpenDate" runat="server" CssClass="datepick" Width="90%" &gt;&lt;/asp:TextBox&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
  
           &lt;asp:TemplateField HeaderText="Registration Close Date" SortExpression="sgvRegCloseDate"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditRegCloseDate" runat="server" CssClass="datepick" Text='&lt;%# Bind("RegistrationClose", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblRegCloseDate" runat="server" Text='&lt;%# Bind("RegistrationClose", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertRegCloseDate" runat="server" CssClass="datepick" Width="90%"&gt;&lt;/asp:TextBox&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
  
          &lt;asp:TemplateField HeaderText="Section Start Date" SortExpression="sgvSecStartDate"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditSecStartDate" runat="server" CssClass="datepick" Text='&lt;%# Bind("SectionStart", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblSecStartDate" runat="server" Text='&lt;%# Bind("SectionStart", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertSecStartDate" runat="server" CssClass="datepick" Width="90%"&gt;&lt;/asp:TextBox&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
  
           &lt;asp:TemplateField HeaderText="Section End Date" SortExpression="sgvSecEndDate"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditSecEndDate" runat="server" CssClass="datepick" Text='&lt;%# Bind("SectionEnd", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblSecEndDate" runat="server" Text='&lt;%# Bind("SectionEnd", "{0:MM-dd-yyyy}") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertSecEndDate" runat="server" CssClass="datepick" Width="90%"&gt;&lt;/asp:TextBox&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
  
           &lt;asp:TemplateField HeaderText="Member Price"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditMemberPrice" runat="server" Text='&lt;%# Bind("MemberPrice", "{0:f}") %&gt;'&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValEditMemberPrice" ControlToValidate="sgvEditMemberPrice" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="EditSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValEditMemberPrice" ControlToValidate="sgvEditMemberPrice" runat="server" 
                       ErrorMessage="Enter currency format." ValidationGroup="EditSectionValidation" ValidationExpression="^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblMemberPrice" runat="server" Text='&lt;%# Bind("MemberPrice", "{0:C}") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertMemberPrice" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertMemberPrice" ControlToValidate="sgvInsertMemberPrice" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertMemberPrice" ControlToValidate="sgvInsertMemberPrice" runat="server" 
                       ErrorMessage="Enter currency format." ValidationGroup="InsertSectionValidation" ValidationExpression="^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
  
           &lt;asp:TemplateField HeaderText="Non-member Price"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="sgvEditNonMemberPrice" runat="server" Text='&lt;%# Bind("NonMemberPrice", "{0:f}") %&gt;'&gt;&lt;/asp:TextBox&gt;
                   &lt;asp:RequiredFieldValidator ID="ReqFieldValEditNonMemberPrice" ControlToValidate="sgvEditNonMemberPrice" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="EditSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValEditNonMemberPrice" ControlToValidate="sgvEditNonMemberPrice" runat="server" 
                       ErrorMessage="Enter currency format." ValidationGroup="EditSectionValidation" ValidationExpression="^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="sgvLblNonMemberPrice" runat="server" Text='&lt;%# Bind("NonMemberPrice", "{0:C}") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:TextBox ID="sgvInsertNonMemberPrice" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                   &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertNonMemberPrice" ControlToValidate="sgvInsertNonMemberPrice" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertNonMemberPrice" ControlToValidate="sgvInsertNonMemberPrice" runat="server" 
                       ErrorMessage="Enter currency format." ValidationGroup="InsertSectionValidation" ValidationExpression="^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                   &lt;/asp:RegularExpressionValidator&gt;
              &lt;/FooterTemplate&gt;
              &lt;HeaderStyle ForeColor="Black" /&gt;
          &lt;/asp:TemplateField&gt;
  
          &lt;asp:TemplateField HeaderText="Action" ShowHeader="False"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:Button ID="sgvImgUpdate" runat="server" CausesValidation="True" ValidationGroup="EditSectionValidation"  CommandName="Update" Text="Update"&gt;&lt;/asp:Button&gt;
                  &amp;nbsp;&lt;asp:Button ID="sgvImgCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"&gt;&lt;/asp:Button&gt;
              &lt;/EditItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Button ID="sgvEditButton" runat="server" CausesValidation="false" CommandName="Edit" Text="Edit" Width="40%"&gt;&lt;/asp:Button&gt;
                  &lt;asp:Button ID="sgvDeleteButton" runat="server" CausesValidation="false" CommandName="Delete" Text="Delete" Width="40%"&gt;&lt;/asp:Button&gt;
              &lt;/ItemTemplate&gt;
              &lt;ItemStyle HorizontalAlign="Center" /&gt;
              &lt;FooterTemplate&gt;
                  &lt;asp:Button ID="sgvBtnAdd" runat="server" CommandName="Add" Text="Add Section" Width="90%" CausesValidation="true" ValidationGroup="InsertSectionValidation" /&gt;
              &lt;/FooterTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
      &lt;EmptyDataTemplate&gt;
          &lt;tr&gt; 
              &lt;td colspan="11" style="text-align:center;"&gt;
              No section data was found for this course. Sections can be added to this course by clicking the 'Add Section' Button.
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertCourseID" runat="server" ReadOnly="true" Width="90%"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertName" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertNameEmpty" ControlToValidate="sgvInsertName" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertNameEmpty" ControlToValidate="sgvInsertName" runat="server" 
                       ErrorMessage="Maximum length is 255." ValidationGroup="InsertSectionValidation" ValidationExpression="^{1,255}$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertSKU" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertSKUEmpty" ControlToValidate="sgvInsertSKU" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertSKUEmpty" ControlToValidate="sgvInsertSKU" runat="server" 
                       ErrorMessage="Enter alphanumeric, hyphen, or forward slash. Maximum length is 100." ValidationGroup="InsertSectionValidation" ValidationExpression="^[\w-/]{1,100}$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertRegOpenDate" runat="server" CssClass="datepick" Width="90%"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertRegCloseDate" runat="server" CssClass="datepick" Width="90%"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertSecStartDate" runat="server" CssClass="datepick" Width="90%"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertSecEndDate" runat="server" CssClass="datepick" Width="90%"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertMemberPrice" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertMemberPriceEmpty" ControlToValidate="sgvInsertMemberPrice" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertMemberPriceEmpty" ControlToValidate="sgvInsertMemberPrice" runat="server" 
                       ErrorMessage="Enter currency format." ValidationGroup="InsertSectionValidation" ValidationExpression="^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;asp:TextBox ID="sgvInsertNonMemberPrice" runat="server" Width="90%"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="ReqFieldValInsertNonMemberPriceEmpty" ControlToValidate="sgvInsertNonMemberPrice" runat="server" 
                       ErrorMessage="Required field." ValidationGroup="InsertSectionValidation" Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RequiredFieldValidator&gt;
                  &lt;asp:RegularExpressionValidator ID="RegExpValInsertNonMemberPriceEmpty" ControlToValidate="sgvInsertNonMemberPrice" runat="server" 
                       ErrorMessage="Enter currency format." ValidationGroup="InsertSectionValidation" ValidationExpression="^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$" 
                       Display="Dynamic" CssClass="message-error"&gt;
                  &lt;/asp:RegularExpressionValidator&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;asp:Button ID="sgvBtnAddEmpty" runat="server" CommandName="Add" Text="Add Section" Width="90%" CausesValidation="true" ValidationGroup="InsertSectionValidation" /&gt;&lt;/td&gt;
           &lt;/tr&gt;
      &lt;/EmptyDataTemplate&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>This is the code behind although it does not get to this method before the validation is triggered.  Just in case you need it...</p>
  
  <pre><code>  protected void SectionGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
      {
          GridViewRow row = (GridViewRow)SectionGridView.Rows[e.RowIndex];
  
          //Save the current section and course selections
          int tiSectionID = Convert.ToInt32(ddlSections.SelectedValue.ToString());
  
          int tiCourseID = Convert.ToInt32((row.FindControl("sgvDdlCourseID") as DropDownList).SelectedValue);
          string tstrName = (row.FindControl("sgvEditName") as TextBox).Text;
          string tstrSKU = (row.FindControl("sgvEditSKU") as TextBox).Text;
  
          Nullable&lt;DateTime&gt; tdtRegOpenDate = setStartTime((row.FindControl("sgvEditRegOpenDate") as TextBox).Text);
          Nullable&lt;DateTime&gt; tdtRegCloseDate = setEndTime((row.FindControl("sgvEditRegCloseDate") as TextBox).Text);
          Nullable&lt;DateTime&gt; tdtSecStartDate = setStartTime((row.FindControl("sgvEditSecStartDate") as TextBox).Text);
          Nullable&lt;DateTime&gt; tdtSecEndDate = setEndTime((row.FindControl("sgvEditSecEndDate") as TextBox).Text);
  
          decimal tdMemberPrice = Convert.ToDecimal((row.FindControl("sgvEditMemberPrice") as TextBox).Text);
          decimal tdNonMemberPrice = Convert.ToDecimal((row.FindControl("sgvEditNonMemberPrice") as TextBox).Text);
  
          DAL.updateSections(tiSectionID, tiCourseID, tstrName, tstrSKU, tdtRegOpenDate, tdtRegCloseDate, tdtSecStartDate, tdtSecEndDate, tdMemberPrice, tdNonMemberPrice);
  
          //Refresh the section grid to include the updated row
          SectionGridView.EditIndex = -1;
          populateSectionGrid();
  
          //Refresh the dropdown list for sections
          populateDropDownSectionList(tiSectionID);
      }
  </code></pre>