title: How to restrict button to cause validation to specific controls?
body: <p>I have textboxes and a grid view. Inside grid view there are text boxes which are also validating. And in the footer there is a button which create new row if grid view current row pass the validation. </p>
  
  <p>The problem is that when button inside grid view is pressed it also validates the contents outside the grid. How to control this?</p>
  
  <p>My aspx code is as:</p>
  
  <pre><code>  &lt;h4&gt;Worked Date&lt;/h4&gt;
       &lt;asp:TextBox runat="server" ID="txtDateOfWorkForInserting" CssClass="form-control" EnableViewState="false" ClientIDMode="Static" ValidateEmptyText="true"/&gt;
       &lt;asp:RequiredFieldValidator ID="rfvDateOgWork"
       CssClass="text-danger" ControlToValidate="txtDateOfWorkForInserting"
        runat="server" EnableViewState="true" ErrorMessage="*" ToolTip="Select Date" Display="Dynamic" &gt;&lt;/asp:RequiredFieldValidator&gt;
  
        &lt;asp:GridView ID="gvWorkDone" runat="server" ShowFooter="True" AutoGenerateColumns="False"
                      CellPadding="4"  GridLines="None" OnRowDeleting="gvWorkDone_RowDeleting" CssClass="table-responsive table table-striped"
                      Style="text-align: left" &gt;
                      &lt;Columns&gt;
                          &lt;asp:BoundField DataField="RowNumber" HeaderText="SNo" /&gt;
                          &lt;asp:TemplateField HeaderText="Work Description"&gt;
                              &lt;ItemTemplate&gt;
                                  &lt;asp:TextBox ID="txtWorkDone" runat="server" CssClass="form-control multilineTextbox" TextMode="MultiLine" &gt;&lt;/asp:TextBox&gt;
                                  &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtWorkDone"
                                      ErrorMessage="*" SetFocusOnError="True" InitialValue="&lt;% %&gt;"&gt;&lt;/asp:RequiredFieldValidator&gt;
                              &lt;/ItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                          &lt;asp:TemplateField HeaderText="Time To Complete"&gt;
                              &lt;ItemTemplate&gt;
                                   &lt;asp:DropDownList runat="server" ID="ddlTotalTime"&gt;
                              &lt;asp:ListItem Selected="True"&gt;1&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;4&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;5&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;6&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;7&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;8&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;9&lt;/asp:ListItem&gt;
                          &lt;/asp:DropDownList&gt;
                                  &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlTotalTime"
                                      ErrorMessage="*" SetFocusOnError="True"&gt;&lt;/asp:RequiredFieldValidator&gt;
                              &lt;/ItemTemplate&gt;
                              &lt;FooterStyle HorizontalAlign="Right" /&gt;
                              &lt;FooterTemplate&gt;
                                  &lt;asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" OnClick="ButtonAdd_Click" /&gt;
                              &lt;/FooterTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                      &lt;asp:CommandField ShowDeleteButton="True" /&gt;
                      &lt;/Columns&gt;              
                  &lt;/asp:GridView&gt;
  </code></pre>